1 ! Test 'allocatable' with OpenMP 'target' 'map' clauses.
3 ! See also '../libgomp.oacc-fortran/allocatable-1-1.f90'.
6 ! { dg-additional-options "-cpp" }
7 ! { dg-additional-options "-DMEM_SHARED" { target offload_device_shared_as } }
11 integer, allocatable
:: a
, b
, c
, d
, e
16 b
= 25 ! Implicit allocation.
18 c
= 52 ! Implicit allocation.
20 !No 'allocate (d)' here.
22 !No 'allocate (e)' here.
24 !$omp target map(to: a) map(tofrom: b, c, d) map(from: e)
26 if (.not
. allocated (a
)) stop 1
30 if (.not
. allocated (b
)) stop 3
33 if (.not
. allocated (c
)) stop 5
37 if (allocated (d
)) stop 7
38 d
= 42 ! Implicit allocation, but on device only.
39 if (.not
. allocated (d
)) stop 8
40 deallocate (d
) ! OpenMP requires must be "unallocated upon exit from the region".
42 if (allocated (e
)) stop 9
43 e
= 24 ! Implicit allocation, but on device only.
44 if (.not
. allocated (e
)) stop 10
45 deallocate (e
) ! OpenMP requires must be "unallocated upon exit from the region".
49 if (.not
. allocated (a
)) stop 20
51 if (a
.ne
. 33) stop 21
53 if (a
.ne
. 11) stop 22
57 if (.not
. allocated (b
)) stop 23
58 if (b
.ne
. 25) stop 24
61 if (.not
. allocated (c
)) stop 25
62 if (c
.ne
. 10) stop 26
65 if (allocated (d
)) stop 27
67 if (allocated (e
)) stop 28