1 ! Offloading test checking interaction of allocatables
2 ! with target in different scopes
3 ! REQUIRES: flang, amdgpu
5 ! RUN: %libomptarget-compile-fortran-run-and-check-generic
8 subroutine func_arg(arg_alloc
)
9 integer, allocatable
, intent (inout
) :: arg_alloc(:)
11 !$omp target map(tofrom: arg_alloc)
13 arg_alloc(index
) = arg_alloc(index
) + index
18 end subroutine func_arg
22 integer, allocatable
:: local_alloc(:)
23 allocate(local_alloc(10))
25 !$omp target map(tofrom: local_alloc)
27 local_alloc(index
) = index
33 deallocate(local_alloc
)
39 integer, allocatable
:: map_ptr(:)
43 !$omp target map(tofrom: map_ptr)
45 map_ptr(index
) = index
53 call func_arg(map_ptr
)
58 ! CHECK: 1 2 3 4 5 6 7 8 9 10
59 ! CHECK: 1 2 3 4 5 6 7 8 9 10
60 ! CHECK: 2 4 6 8 10 12 14 16 18 20