[Openmp-commits] [flang] [openmp] [flang] Changes to map variables in link clause of declare target (PR #83643)

Anchu Rajendran S via Openmp-commits openmp-commits at lists.llvm.org
Wed Mar 6 11:47:09 PST 2024


================
@@ -11,23 +11,59 @@
 ! RUN: %libomptarget-compile-fortran-run-and-check-generic
 module test_0
     implicit none
-    INTEGER :: sp(10) = (/0,0,0,0,0,0,0,0,0,0/)
-    !$omp declare target link(sp)
+    INTEGER :: arr1(10) = (/0,0,0,0,0,0,0,0,0,0/)
+    INTEGER :: arr2(10) = (/0,0,0,0,0,0,0,0,0,0/)
+    !$omp declare target link(arr1) enter(arr2)
 end module test_0
 
-program main
+subroutine test_with_array_link_and_tofrom()
     use test_0
     integer :: i = 1
     integer :: j = 11
-!$omp target map(tofrom:sp, i, j)
+!$omp target map(tofrom:arr1, i, j)
     do while (i <= j)
-        sp(i) = i;
+        arr1(i) = i;
         i = i + 1
     end do
 !$omp end target
 
-PRINT *, sp(:)
+! CHECK: 1 2 3 4 5 6 7 8 9 10
+PRINT *, arr1(:)
+end subroutine test_with_array_link_and_tofrom
 
-end program
+subroutine test_with_array_link_only()
+use test_0
+integer :: i = 1
+integer :: j = 11
+!$omp target map(i, j)
----------------
anchuraj wrote:

Thanks @agozillon. Testing on a scalar would be more appropriate as you said , I have added a new test applying link to a scalar. 

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


More information about the Openmp-commits mailing list