Skip gnat.dg/prot7.adb on hppa.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-fortran / allocatable-1-1.f90
blobe5981312f1484f9742d741f0e41bb315a63e8135
1 ! Test 'allocatable' with OpenACC data clauses.
3 ! See also '../libgomp.fortran/target-allocatable-1-1.f90'.
5 ! { dg-do run }
6 ! { dg-additional-options "-cpp" }
8 program main
9 implicit none
10 integer, allocatable :: a, b, c, d, e
12 allocate (a)
13 a = 11
15 b = 25 ! Implicit allocation.
17 c = 52 ! Implicit allocation.
19 !No 'allocate (d)' here.
21 !No 'allocate (e)' here.
23 !$acc parallel copyin(a) copy(b, c, d) copyout(e)
25 if (.not. allocated (a)) stop 1
26 if (a .ne. 11) stop 2
27 a = 33
29 if (.not. allocated (b)) stop 3
30 if (b .ne. 25) stop 4
32 if (.not. allocated (c)) stop 5
33 if (c .ne. 52) stop 6
34 c = 10
36 if (allocated (d)) stop 7
37 d = 42 ! Implicit allocation, but on device only.
38 if (.not. allocated (d)) stop 8
39 deallocate (d) ! OpenMP requires must be "unallocated upon exit from the region".
41 if (allocated (e)) stop 9
42 e = 24 ! Implicit allocation, but on device only.
43 if (.not. allocated (e)) stop 10
44 deallocate (e) ! OpenMP requires must be "unallocated upon exit from the region".
46 !$acc end parallel
48 if (.not. allocated (a)) stop 20
49 #if ACC_MEM_SHARED
50 if (a .ne. 33) stop 21
51 #else
52 if (a .ne. 11) stop 22
53 #endif
54 deallocate (a)
56 if (.not. allocated (b)) stop 23
57 if (b .ne. 25) stop 24
58 deallocate (b)
60 if (.not. allocated (c)) stop 25
61 if (c .ne. 10) stop 26
62 deallocate (c)
64 if (allocated (d)) stop 27
66 if (allocated (e)) stop 28
68 end program main