PR c++/86342 - -Wdeprecated-copy and system headers.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-fortran / data-1.f90
blobbf323b3f54057edd2ff6d76d3aed1d7a9972ef77
1 ! { dg-do run }
2 ! { dg-additional-options "-cpp" }
4 function is_mapped (n) result (rc)
5 use openacc
7 integer, intent (in) :: n
8 logical rc
10 #if ACC_MEM_SHARED
11 integer i
13 rc = .TRUE.
14 i = n
15 #else
16 rc = acc_is_present (n, sizeof (n))
17 #endif
19 end function is_mapped
21 program main
22 integer i, j
23 logical is_mapped
25 i = -1
26 j = -2
28 !$acc data copyin (i, j)
29 if (is_mapped (i) .eqv. .FALSE.) call abort
30 if (is_mapped (j) .eqv. .FALSE.) call abort
32 if (i .ne. -1 .or. j .ne. -2) call abort
34 i = 2
35 j = 1
37 if (i .ne. 2 .or. j .ne. 1) call abort
38 !$acc end data
40 if (i .ne. 2 .or. j .ne. 1) call abort
42 i = -1
43 j = -2
45 !$acc data copyout (i, j)
46 if (is_mapped (i) .eqv. .FALSE.) call abort
47 if (is_mapped (j) .eqv. .FALSE.) call abort
49 if (i .ne. -1 .or. j .ne. -2) call abort
51 i = 2
52 j = 1
54 if (i .ne. 2 .or. j .ne. 1) call abort
56 !$acc parallel present (i, j)
57 i = 4
58 j = 2
59 !$acc end parallel
60 !$acc end data
62 if (i .ne. 4 .or. j .ne. 2) call abort
64 i = -1
65 j = -2
67 !$acc data create (i, j)
68 if (is_mapped (i) .eqv. .FALSE.) call abort
69 if (is_mapped (j) .eqv. .FALSE.) call abort
71 if (i .ne. -1 .or. j .ne. -2) call abort
73 i = 2
74 j = 1
76 if (i .ne. 2 .or. j .ne. 1) call abort
77 !$acc end data
79 if (i .ne. 2 .or. j .ne. 1) call abort
81 i = -1
82 j = -2
84 !$acc data present_or_copyin (i, j)
85 if (is_mapped (i) .eqv. .FALSE.) call abort
86 if (is_mapped (j) .eqv. .FALSE.) call abort
88 if (i .ne. -1 .or. j .ne. -2) call abort
90 i = 2
91 j = 1
93 if (i .ne. 2 .or. j .ne. 1) call abort
94 !$acc end data
96 if (i .ne. 2 .or. j .ne. 1) call abort
98 i = -1
99 j = -2
101 !$acc data present_or_copyout (i, j)
102 if (is_mapped (i) .eqv. .FALSE.) call abort
103 if (is_mapped (j) .eqv. .FALSE.) call abort
105 if (i .ne. -1 .or. j .ne. -2) call abort
107 i = 2
108 j = 1
110 if (i .ne. 2 .or. j .ne. 1) call abort
112 !$acc parallel present (i, j)
113 i = 4
114 j = 2
115 !$acc end parallel
116 !$acc end data
118 if (i .ne. 4 .or. j .ne. 2) call abort
120 i = -1
121 j = -2
123 !$acc data present_or_copy (i, j)
124 if (is_mapped (i) .eqv. .FALSE.) call abort
125 if (is_mapped (j) .eqv. .FALSE.) call abort
127 if (i .ne. -1 .or. j .ne. -2) call abort
129 i = 2
130 j = 1
132 if (i .ne. 2 .or. j .ne. 1) call abort
133 !$acc end data
135 #if ACC_MEM_SHARED
136 if (i .ne. 2 .or. j .ne. 1) call abort
137 #else
138 if (i .ne. -1 .or. j .ne. -2) call abort
139 #endif
141 i = -1
142 j = -2
144 !$acc data present_or_create (i, j)
145 if (is_mapped (i) .eqv. .FALSE.) call abort
146 if (is_mapped (j) .eqv. .FALSE.) call abort
148 i = 2
149 j = 1
151 if (i .ne. 2 .or. j .ne. 1) call abort
152 !$acc end data
154 if (i .ne. 2 .or. j .ne. 1) call abort
156 i = -1
157 j = -2
159 !$acc data copyin (i, j)
160 !$acc data present (i, j)
161 if (is_mapped (i) .eqv. .FALSE.) call abort
162 if (is_mapped (j) .eqv. .FALSE.) call abort
164 if (i .ne. -1 .or. j .ne. -2) call abort
166 i = 2
167 j = 1
169 if (i .ne. 2 .or. j .ne. 1) call abort
170 !$acc end data
171 !$acc end data
173 if (i .ne. 2 .or. j .ne. 1) call abort
175 i = -1
176 j = -2
178 !$acc data copyin (i, j)
179 !$acc data present (i, j)
180 if (is_mapped (i) .eqv. .FALSE.) call abort
181 if (is_mapped (j) .eqv. .FALSE.) call abort
183 if (i .ne. -1 .or. j .ne. -2) call abort
185 i = 2
186 j = 1
188 if (i .ne. 2 .or. j .ne. 1) call abort
189 !$acc end data
190 !$acc end data
192 if (i .ne. 2 .or. j .ne. 1) call abort
194 i = -1
195 j = -2
197 !$acc data
198 #if !ACC_MEM_SHARED
199 if (is_mapped (i) .eqv. .TRUE.) call abort
200 if (is_mapped (j) .eqv. .TRUE.) call abort
201 #endif
202 if (i .ne. -1 .or. j .ne. -2) call abort
204 i = 2
205 j = 1
207 if (i .ne. 2 .or. j .ne. 1) call abort
208 !$acc end data
210 if (i .ne. 2 .or. j .ne. 1) call abort
212 end program main