1! Offloading test checking interaction of pointers with target in different 2! scopes 3! REQUIRES: flang, amdgpu 4 5! RUN: %libomptarget-compile-fortran-run-and-check-generic 6module test 7 contains 8 subroutine func_arg(arg_alloc) 9 integer, pointer, intent (inout) :: arg_alloc(:) 10 11 !$omp target enter data map(alloc: arg_alloc) 12 13 !$omp target 14 do index = 1, 10 15 arg_alloc(index) = arg_alloc(index) + index 16 end do 17 !$omp end target 18 19 !$omp target exit data map(from: arg_alloc) 20 21 !$omp target exit data map(delete: arg_alloc) 22 23 print *, arg_alloc 24 end subroutine func_arg 25end module 26 27subroutine func 28 integer, pointer :: local_alloc(:) 29 allocate(local_alloc(10)) 30 31 !$omp target enter data map(alloc: local_alloc) 32 33 !$omp target 34 do index = 1, 10 35 local_alloc(index) = index 36 end do 37 !$omp end target 38 39 !$omp target exit data map(from: local_alloc) 40 41 !$omp target exit data map(delete: local_alloc) 42 43 print *, local_alloc 44 45 deallocate(local_alloc) 46end subroutine func 47 48 49program main 50 use test 51 integer, pointer :: map_ptr(:) 52 allocate(map_ptr(10)) 53 54 !$omp target enter data map(alloc: map_ptr) 55 56 !$omp target 57 do index = 1, 10 58 map_ptr(index) = index 59 end do 60 !$omp end target 61 62 !$omp target exit data map(from: map_ptr) 63 64 !$omp target exit data map(delete: map_ptr) 65 66 call func 67 68 print *, map_ptr 69 70 call func_arg(map_ptr) 71 72 deallocate(map_ptr) 73end program 74 75! CHECK: 1 2 3 4 5 6 7 8 9 10 76! CHECK: 1 2 3 4 5 6 7 8 9 10 77! CHECK: 2 4 6 8 10 12 14 16 18 20 78