[flang-commits] [flang] [flang][cuda] Add TODO for allocate with device source (PR #163630)
Valentin Clement バレンタイン クレメン via flang-commits
flang-commits at lists.llvm.org
Wed Oct 15 14:26:30 PDT 2025
https://github.com/clementval created https://github.com/llvm/llvm-project/pull/163630
None
>From 85a8aca84dbcb2451f7f3388fca51e234e2efeed Mon Sep 17 00:00:00 2001
From: Valentin Clement <clementval at gmail.com>
Date: Wed, 15 Oct 2025 14:05:55 -0700
Subject: [PATCH] [flang][cuda] Add TODO for allocate with device source
---
flang/lib/Lower/Allocatable.cpp | 4 ++++
.../test/Lower/CUDA/TODO/cuda-allocate-source-device.cuf | 9 +++++++++
2 files changed, 13 insertions(+)
create mode 100644 flang/test/Lower/CUDA/TODO/cuda-allocate-source-device.cuf
diff --git a/flang/lib/Lower/Allocatable.cpp b/flang/lib/Lower/Allocatable.cpp
index 460ed62d5337f..4b7a846c5e272 100644
--- a/flang/lib/Lower/Allocatable.cpp
+++ b/flang/lib/Lower/Allocatable.cpp
@@ -629,6 +629,10 @@ class AllocateStmtHelper {
unsigned allocatorIdx = Fortran::lower::getAllocatorIdx(alloc.getSymbol());
fir::ExtendedValue exv = isSource ? sourceExv : moldExv;
+ if (const Fortran::semantics::Symbol * sym{GetLastSymbol(sourceExpr)})
+ if (Fortran::semantics::IsCUDADevice(*sym))
+ TODO(loc, "CUDA Fortran: allocate with device source");
+
// Generate a sequence of runtime calls.
errorManager.genStatCheck(builder, loc);
genAllocateObjectInit(box, allocatorIdx);
diff --git a/flang/test/Lower/CUDA/TODO/cuda-allocate-source-device.cuf b/flang/test/Lower/CUDA/TODO/cuda-allocate-source-device.cuf
new file mode 100644
index 0000000000000..3e59e2f01119e
--- /dev/null
+++ b/flang/test/Lower/CUDA/TODO/cuda-allocate-source-device.cuf
@@ -0,0 +1,9 @@
+! RUN: %not_todo_cmd bbc -emit-fir -fcuda -o - %s 2>&1 | FileCheck %s
+
+program main
+ implicit none
+ integer, device, allocatable :: a_d(:)
+ integer, allocatable :: a(:)
+! CHECK: not yet implemented: CUDA Fortran: allocate with device source
+ allocate(a, source=a_d)
+end program
More information about the flang-commits
mailing list