[Fortran] OpenACC – permit common blocks in some clauses
[official-gcc.git] / libgomp / testsuite / libgomp.fortran / target-allocatable-1-1.f90
blob429a855a20b215433d1f56d1ce23ec9dc4ff6f3b
1 ! Test 'allocatable' with OpenMP 'target' 'map' clauses.
3 ! See also '../libgomp.oacc-fortran/allocatable-1-1.f90'.
5 ! { dg-do run }
6 ! { dg-additional-options "-cpp" }
7 ! { dg-additional-options "-DMEM_SHARED" { target offload_device_shared_as } }
9 program main
10 implicit none
11 integer, allocatable :: a, b, c, d, e
13 allocate (a)
14 a = 11
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
27 if (a .ne. 11) stop 2
28 a = 33
30 if (.not. allocated (b)) stop 3
31 if (b .ne. 25) stop 4
33 if (.not. allocated (c)) stop 5
34 if (c .ne. 52) stop 6
35 c = 10
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".
47 !$omp end target
49 if (.not. allocated (a)) stop 20
50 #ifdef MEM_SHARED
51 if (a .ne. 33) stop 21
52 #else
53 if (a .ne. 11) stop 22
54 #endif
55 deallocate (a)
57 if (.not. allocated (b)) stop 23
58 if (b .ne. 25) stop 24
59 deallocate (b)
61 if (.not. allocated (c)) stop 25
62 if (c .ne. 10) stop 26
63 deallocate (c)
65 if (allocated (d)) stop 27
67 if (allocated (e)) stop 28
69 end program main