[flang-commits] [flang] [flang][CUDA] Preserve data attrs on assignment RHS (PR #207849)

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Thu Jul 9 05:06:13 PDT 2026


================
@@ -0,0 +1,34 @@
+! RUN: %python %S/../test_errors.py %s %flang_fc1
+
+module m
+  type box
+    integer :: n
+  end type
+
+  interface assignment(=)
+    module procedure assign_host
+    module procedure assign_device
+  end interface
+
+contains
+  subroutine assign_host(lhs, rhs)
+    type(box), intent(inout) :: lhs
+    real, intent(in) :: rhs(:)
+  end subroutine
+
+  subroutine assign_device(lhs, rhs)
+    type(box), intent(inout) :: lhs
+    real, device, intent(in) :: rhs(:)
+  end subroutine
+end module
+
+subroutine test
+  use m
+  type(box) :: lhs
+  real :: host(4)
+  real, device, allocatable :: dev(:)
+  allocate(dev(4))
+
+  lhs = host
+  lhs = dev
----------------
eugeneepshteyn wrote:

What about things like `lhs = dev + dev`? What behavior do we want in this case?

https://github.com/llvm/llvm-project/pull/207849


More information about the flang-commits mailing list