[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:01:54 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
----------------
eugeneepshteyn wrote:
> semantic is adding the parenthesis around the RHS when building the procedure ref for a user defined assignment (lhs = rhs gives foo(lhs, (rhs)))
Please add a comment here to make it more obvious that this is what's being tested.
Also, please add different actual explicit parenthesized variable tests that will take the new code path. This may help to see, if we actually want the new behavior for all such cases, or whether we may want to exclude some of them from the new functionality.
https://github.com/llvm/llvm-project/pull/207849
More information about the flang-commits
mailing list