[flang-commits] [flang] 6574a2e - [flang][cuda] Add TODO for allocate with device source (#163630)
via flang-commits
flang-commits at lists.llvm.org
Wed Oct 15 15:08:48 PDT 2025
Author: Valentin Clement (バレンタイン クレメン)
Date: 2025-10-15T15:08:44-07:00
New Revision: 6574a2e5e0c1c4d13cba7f986605dc516dded2c2
URL: https://github.com/llvm/llvm-project/commit/6574a2e5e0c1c4d13cba7f986605dc516dded2c2
DIFF: https://github.com/llvm/llvm-project/commit/6574a2e5e0c1c4d13cba7f986605dc516dded2c2.diff
LOG: [flang][cuda] Add TODO for allocate with device source (#163630)
Added:
flang/test/Lower/CUDA/TODO/cuda-allocate-source-device.cuf
Modified:
flang/lib/Lower/Allocatable.cpp
Removed:
################################################################################
diff --git a/flang/lib/Lower/Allocatable.cpp b/flang/lib/Lower/Allocatable.cpp
index 460ed62d5337f..e7a6c4df40045 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