1 ! Test 'allocatable' with OpenMP 'target' 'map' clauses, subroutine in module,
4 ! See also '../libgomp.oacc-fortran/allocatable-1-2.f90'.
7 ! { dg-additional-options "-cpp" }
8 ! { dg-additional-options "-DMEM_SHARED" { target offload_device_shared_as } }
12 subroutine r (a, b, c, d, e)
14 integer, allocatable :: a, b, c, d, e
16 !$omp target map(to: a) map(tofrom: b, c, d) map(from: e)
18 if (.not. allocated (a)) stop 1
22 if (.not. allocated (b)) stop 3
25 if (.not. allocated (c)) stop 5
29 if (allocated (d)) stop 7
30 d = 42 ! Implicit allocation, but on device only.
31 if (.not. allocated (d)) stop 8
32 deallocate (d) ! OpenMP requires must be "unallocated upon exit from the region".
34 if (allocated (e)) stop 9
35 e = 24 ! Implicit allocation, but on device only.
36 if (.not. allocated (e)) stop 10
37 deallocate (e) ! OpenMP requires must be "unallocated upon exit from the region".
47 integer, allocatable :: a, b, c, d, e
52 b = 25 ! Implicit allocation.
54 c = 52 ! Implicit allocation.
56 !No 'allocate (d)' here.
58 !No 'allocate (e)' here.
62 if (.not. allocated (a)) stop 20
64 if (a .ne. 33) stop 21
66 if (a .ne. 11) stop 22
70 if (.not. allocated (b)) stop 23
71 if (b .ne. 25) stop 24
74 if (.not. allocated (c)) stop 25
75 if (c .ne. 10) stop 26
78 if (allocated (d)) stop 27
80 if (allocated (e)) stop 28