59 lines · plain
1! Offloading test checking interaction of pointer and target with target across2! multiple scopes3! REQUIRES: flang, amdgpu4 5! RUN: %libomptarget-compile-fortran-run-and-check-generic6module test7 contains8 subroutine func_arg(arg_alloc)9 integer, pointer, intent (inout) :: arg_alloc(:)10 11 !$omp target map(tofrom: arg_alloc)12 do index = 1, 1013 arg_alloc(index) = arg_alloc(index) + index14 end do15 !$omp end target16 17 print *, arg_alloc18 end subroutine func_arg19end module20 21subroutine func22 integer, pointer :: local_alloc(:)23 integer, target :: b(10)24 local_alloc => b25 26 !$omp target map(tofrom: local_alloc)27 do index = 1, 1028 local_alloc(index) = index29 end do30 !$omp end target31 32 print *, local_alloc33 end subroutine func34 35 36 program main37 use test38 integer, pointer :: map_ptr(:)39 integer, target :: b(10)40 41 map_ptr => b42 43 !$omp target map(tofrom: map_ptr)44 do index = 1, 1045 map_ptr(index) = index46 end do47 !$omp end target48 49 call func50 51 print *, map_ptr52 53 call func_arg(map_ptr)54end program55 56!CHECK: 1 2 3 4 5 6 7 8 9 1057!CHECK: 1 2 3 4 5 6 7 8 9 1058!CHECK: 2 4 6 8 10 12 14 16 18 2059