Debian Codegraph @

libgomp/testsuite/libgomp.oacc-fortran/allocatable-1-1.f90

raw
1 ! Test 'allocatable' with OpenACC data clauses.
2
3 ! See also '../libgomp.fortran/target-allocatable-1-1.f90'.
4
5 ! { dg-do run }
6 ! { dg-additional-options "-cpp" }
7
8 program main
9 implicit none
10 integer, allocatable :: a, b, c, d, e
11
12 allocate (a)
13 a = 11
14
15 b = 25 ! Implicit allocation.
16
17 c = 52 ! Implicit allocation.
18
19 !No 'allocate (d)' here.
20
21 !No 'allocate (e)' here.
22
23 !$acc parallel copyin(a) copy(b, c, d) copyout(e)
24
25 if (.not. allocated (a)) stop 1
26 if (a .ne. 11) stop 2
27 a = 33
28
29 if (.not. allocated (b)) stop 3
30 if (b .ne. 25) stop 4
31
32 if (.not. allocated (c)) stop 5
33 if (c .ne. 52) stop 6
34 c = 10
35
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".
40
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".
45
46 !$acc end parallel
47
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)
55
56 if (.not. allocated (b)) stop 23
57 if (b .ne. 25) stop 24
58 deallocate (b)
59
60 if (.not. allocated (c)) stop 25
61 if (c .ne. 10) stop 26
62 deallocate (c)
63
64 if (allocated (d)) stop 27
65
66 if (allocated (e)) stop 28
67
68 end program main