Bump version to 19.1.0-rc3
[llvm-project.git] / offload / test / offloading / fortran / target-map-pointer-target-scopes.f90
blobfcbcf024d9c9df08f992819dade58510c31a73ad
1 ! Offloading test checking interaction of pointer
2 ! and target with target across multiple scopes
3 ! REQUIRES: flang, amdgpu
5 ! RUN: %libomptarget-compile-fortran-run-and-check-generic
6 module test
7 contains
8 subroutine func_arg(arg_alloc)
9 integer, pointer, intent (inout) :: arg_alloc(:)
11 !$omp target map(tofrom: arg_alloc)
12 do index = 1, 10
13 arg_alloc(index) = arg_alloc(index) + index
14 end do
15 !$omp end target
17 print *, arg_alloc
18 end subroutine func_arg
19 end module
21 subroutine func
22 integer, pointer :: local_alloc(:)
23 integer, target :: b(10)
24 local_alloc => b
26 !$omp target map(tofrom: local_alloc)
27 do index = 1, 10
28 local_alloc(index) = index
29 end do
30 !$omp end target
32 print *, local_alloc
33 end subroutine func
36 program main
37 use test
38 integer, pointer :: map_ptr(:)
39 integer, target :: b(10)
41 map_ptr => b
43 !$omp target map(tofrom: map_ptr)
44 do index = 1, 10
45 map_ptr(index) = index
46 end do
47 !$omp end target
49 call func
51 print *, map_ptr
53 call func_arg(map_ptr)
54 end program
56 !CHECK: 1 2 3 4 5 6 7 8 9 10
57 !CHECK: 1 2 3 4 5 6 7 8 9 10
58 !CHECK: 2 4 6 8 10 12 14 16 18 20