[flang-commits] [flang] [flang][cuda] Avoid false positive on multi device symbol with components (PR #192513)
Zhen Wang via flang-commits
flang-commits at lists.llvm.org
Thu Apr 16 12:13:18 PDT 2026
================
@@ -673,3 +673,44 @@ end subroutine
! CHECK-LABEL: func.func @_QPsub37()
! CHECK: cuf.data_transfer
+
+subroutine sub38()
+ type :: bar
+ integer, device, allocatable :: m(:)
+ end type
+ type(bar), unified :: a
+ type(bar), managed :: ma
+ integer :: lm(5)
+
+
+ lm(1:5) = a%m(1:5)
+ lm(1:5) = ma%m(1:5)
+end subroutine
+
+subroutine sub39()
+ type :: foo
+ integer, device, allocatable :: m(:)
+ end type
+ type :: bar
+ type(foo) :: f
+ end type
+ type(bar) :: a
+ integer :: lm(5)
+
+ lm(1:5) = a%f%m(1:5)
+end subroutine
+
+function sub40_call(x, y, n) result(z)
+ integer :: n
+ real, device :: x(n)
+ real, device :: y(n)
+ real :: z
+ z = 0.0
+end function
+
+subroutine sub40()
+ real, device :: x(10)
+ real, device :: y(10)
+ real :: res
+ res = sub40_call(x, y, 10)
+end subroutine
----------------
wangzpgi wrote:
Can you also add a test case like this:
```
subroutine sub_managed_managed()
type :: bar
integer, device, allocatable :: m(:)
end type
type(bar), managed :: a
integer, managed :: lm(5)
lm(1:5) = a%m(1:5)
end subroutine
```
https://github.com/llvm/llvm-project/pull/192513
More information about the flang-commits
mailing list