2 ! { dg-additional-sources allocate-1.c }
3 ! { dg-additional-options -Wno-complain-wrong-lang }
8 implicit none (type, external)
11 integer(c_int
) function is_64bit_aligned (a
) bind(C
)
19 subroutine foo (x
, p
, q
, h
, fl
)
23 integer, dimension(4) :: p
24 integer, dimension(4) :: q
25 integer (kind
=omp_allocator_handle_kind
) :: h
29 integer :: r
, i
, i1
, i2
, i3
, i4
, i5
30 integer :: l
, l3
, l4
, l5
, l6
31 integer :: n
, n2
, n3
, n4
33 integer, dimension(4) :: l2
34 integer, dimension(4) :: r2
37 integer, dimension(x
) :: v
38 integer, dimension(x
) :: w
73 !$omp parallel private (y, v) firstprivate (x) allocate (x, y, v)
84 if (x
/= 43 .or
. y
/= 1) then
87 if (v(1) /= 7 .or
. v(42) /= 8) then
90 if ( (and(fl
, 2) /= 0) .and
. &
91 ((is_64bit_aligned(x
) == 0) .or
. &
92 (is_64bit_aligned(y
) == 0) .or
. &
93 (is_64bit_aligned(v(1)) == 0))) then
98 !$omp parallel private (y) firstprivate (x, w) allocate (h: x, y, w)
100 if (x
/= 42 .or
. w(17) /= 17 .or
. w(42) /= 42) then
108 if (x
/= 43 .or
. y
/= 1 .or
. w(19) /= 20) then
111 if ( (and(fl
, 1) /= 0) .and
. &
112 ((is_64bit_aligned(x
) == 0) .or
. &
113 (is_64bit_aligned(y
) == 0) .or
. &
114 (is_64bit_aligned(w(1)) == 0))) then
120 !$omp parallel do private (y) firstprivate (x) reduction(+: r) allocate (h: x, y, r, l, n) lastprivate (l) linear (n: 16)
129 if ( (and(fl
, 1) /= 0) .and
. &
130 ((is_64bit_aligned(x
) == 0) .or
. &
131 (is_64bit_aligned(y
) == 0) .or
. &
132 (is_64bit_aligned(r
) == 0) .or
. &
133 (is_64bit_aligned(l
) == 0) .or
. &
134 (is_64bit_aligned(n
) == 0))) then
138 !$omp end parallel do
141 !$omp do lastprivate (l2) private (i1) allocate (h: l2, l3, i1) lastprivate (conditional: l3)
150 if ( (and(fl
, 1) /= 0) .and
. &
151 ((is_64bit_aligned(l2(1)) == 0) .or
. &
152 (is_64bit_aligned(l3
) == 0) .or
. &
153 (is_64bit_aligned(i1
) == 0))) then
158 !$omp do collapse(2) lastprivate(l4, i2, j2) linear (n2:17) allocate (h: n2, l4, i2, j2)
163 if ( (and(fl
, 1) /= 0) .and
. &
164 ((is_64bit_aligned(l4
) == 0) .or
. &
165 (is_64bit_aligned(n2
) == 0) .or
. &
166 (is_64bit_aligned(i2
) == 0) .or
. &
167 (is_64bit_aligned(j2
) == 0))) then
173 !$omp do collapse(2) lastprivate(l5, i3, j3) linear (n3:17) schedule (static, 3) allocate (n3, l5, i3, j3)
178 if ( (and(fl
, 2) /= 0) .and
. &
179 ((is_64bit_aligned(l5
) == 0) .or
. &
180 (is_64bit_aligned(n3
) == 0) .or
. &
181 (is_64bit_aligned(i3
) == 0) .or
. &
182 (is_64bit_aligned(j3
) == 0))) then
188 !$omp do collapse(2) lastprivate(l6, i4, j4) linear (n4:17) schedule (dynamic) allocate (h: n4, l6, i4, j4)
193 if ( (and(fl
, 1) /= 0) .and
. &
194 ((is_64bit_aligned(l6
) == 0) .or
. &
195 (is_64bit_aligned(n4
) == 0) .or
. &
196 (is_64bit_aligned(i4
) == 0) .or
. &
197 (is_64bit_aligned(j4
) == 0))) then
203 !$omp do lastprivate (i5) allocate (i5)
205 if ( (and(fl
, 2) /= 0) .and
. &
206 (is_64bit_aligned(i5
) == 0)) then
211 !$omp do reduction(+:p, q, r2) allocate(h: p, q, r2)
214 p(4) = p(4) + (2 * i
)
215 q(1) = q(1) + (3 * i
)
216 q(3) = q(3) + (4 * i
)
217 r2(1) = r2(1) + (5 * i
)
218 r2(4) = r2(4) + (6 * i
)
219 if ( (and(fl
, 1) /= 0) .and
. &
220 ((is_64bit_aligned(q(1)) == 0) .or
. &
221 (is_64bit_aligned(p(1)) == 0) .or
. &
222 (is_64bit_aligned(r2(1)) == 0) )) then
227 !$omp task private(y) firstprivate(x) allocate(x, y)
232 if ( (and(fl
, 2) /= 0) .and
. &
233 ((is_64bit_aligned(x
) == 0) .or
. &
234 (is_64bit_aligned(y
) == 0) )) then
239 !$omp task private(y) firstprivate(x) allocate(h: x, y)
244 if ( (and(fl
, 1) /= 0) .and
. &
245 ((is_64bit_aligned(x
) == 0) .or
. &
246 (is_64bit_aligned(y
) == 0) )) then
251 !$omp task private(y) firstprivate(s) allocate(s, y)
252 if (s
%a
/= 27 .or
. s
%b
/= 29) then
256 if ( (and(fl
, 2) /= 0) .and
. &
257 ((is_64bit_aligned(s
%a
) == 0) .or
. &
258 (is_64bit_aligned(y
) == 0) )) then
263 !$omp task private(y) firstprivate(s) allocate(h: s, y)
264 if (s
%a
/= 27 .or
. s
%b
/= 29) then
268 if ( (and(fl
, 1) /= 0) .and
. &
269 ((is_64bit_aligned(s
%a
) == 0) .or
. &
270 (is_64bit_aligned(y
) == 0) )) then
277 if (r
/= ((64 * 63) / 2) .or
. l
/= 63 .or
. n
/= (8 + 16 * 64)) then
281 if (l2(1) /= 63 .or
. l2(2) /= 64 .or
. l2(3) /= 65 .or
. l2(4) /= 66 .or
. l3
/= 36) then
285 if (i2
/= 5 .or
. j2
/= 23 .or
. n2
/= (9 + (17 * 6)) .or
. l4
/= (4 * 31 + 21)) then
289 if (i3
/= 5 .or
. j3
/= 23 .or
. n3
/= (10 + (17 * 6)) .or
. l5
/= (4 * 31 + 21)) then
293 if (i4
/= 5 .or
. j4
/= 23 .or
. n4
/= (11 + (17 * 6)) .or
. l6
/= (4 * 31 + 21)) then
301 if (p(3) /= ((32 * 31) / 2) .or
. p(4) /= (2 * p(3)) &
302 .or
. q(1) /= (3 * p(3)) .or
. q(3) /= (4 * p(3)) &
303 .or
. r2(1) /= (5 * p(3)) .or
. r2(4) /= (6 * p(3))) then
312 implicit none (type, external)
313 integer, dimension(4) :: p
314 integer, dimension(4) :: q
316 type (omp_alloctrait
) :: traits(2)
317 integer (omp_allocator_handle_kind
) :: a
319 traits
= [omp_alloctrait (omp_atk_alignment
, 64), &
320 omp_alloctrait (omp_atk_fallback
, omp_atv_null_fb
)]
321 a
= omp_init_allocator (omp_default_mem_space
, 2, traits
)
322 if (a
== omp_null_allocator
) stop 1
324 call omp_set_default_allocator (omp_default_mem_alloc
);
325 call foo (42, p
, q
, a
, 0);
326 call foo (42, p
, q
, omp_default_mem_alloc
, 0);
327 call foo (42, p
, q
, a
, 1);
328 call omp_set_default_allocator (a
);
329 call foo (42, p
, q
, omp_null_allocator
, 3);
330 call foo (42, p
, q
, omp_default_mem_alloc
, 2);
331 call omp_destroy_allocator (a
);