================
@@ -0,0 +1,36 @@
+! Test the implicit `declare target to` interaction with `target update from`
+! REQUIRES: flang, amdgpu
+
+! RUN: %libomptarget-compile-fortran-run-and-check-generic
+module test
+    implicit none
+    integer :: array(10)
+    !$omp declare target(array)
+end module test
+
+PROGRAM main
+    use test
+    implicit none
+    integer :: i
+
+  !$omp target
+    do i = 1, 10
+        array(i) = i
+    end do
+  !$omp end target
+
+  !$omp target
+    do i = 1, 10
+        array(i) = array(i) + i
+    end do
+  !$omp end target
+
+   print *, array
+
+  !$omp target update from(array)
+
+   print *, array
+END PROGRAM
+
+! CHECK: 0 0 0 0 0 0 0 0 0 0
----------------
skatrak wrote:

Is it guaranteed that `array` will by default be initialized with 0? If it's 
UB, it will make this test randomly fail based on compiler optimization flags, 
etc. Better to explicitly initialize it to zero on the host, if that is the 
case.

https://github.com/llvm/llvm-project/pull/119589
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to