5 struct S { int a, b; };
8 foo (int &x, int &y, int &r, int &l, int (&l2)[4], int &l3, int &n, int *&p,
9 int *&q, int &px, struct S &s, omp_allocator_handle_t h, int fl)
16 int r1[4] = { 0, 0, 0, 0 };
19 for (i = 0; i < x; i++)
21 for (i = 0; i < 4; i++)
23 for (i = 0; i < 3; i++)
25 #pragma omp parallel private (y, v2) firstprivate (x) allocate (x, y, v2)
27 int *volatile p1 = &x;
28 int *volatile p2 = &y;
37 if (x != 43 || y != 1)
39 if (v2[0] != 7 || v2[41] != 8)
41 if ((fl & 2) && (((uintptr_t) p1 | (uintptr_t) p2
42 | (uintptr_t) &v2[0]) & 63) != 0)
47 #pragma omp parallel private (y) firstprivate (x, w2) allocate (h: x, y, w2)
49 int *volatile p1 = &x;
50 int *volatile p2 = &y;
51 if (x != 42 || w2[17] != 17 || w2[41] != 41)
58 if (x != 43 || y != 1 || w2[19] != 20)
60 if ((fl & 1) && (((uintptr_t) p1 | (uintptr_t) p2
61 | (uintptr_t) &w2[0]) & 63) != 0)
65 #pragma omp parallel for private (y) firstprivate (x) allocate (h: x, y, r, l, n) reduction(+: r) lastprivate (l) linear (n: 16)
66 for (i = 0; i < 64; i++)
74 if ((fl & 1) && (((uintptr_t) &x | (uintptr_t) &y | (uintptr_t) &r
75 | (uintptr_t) &l | (uintptr_t) &n) & 63) != 0)
81 #pragma omp for lastprivate (l2) allocate (h: l2, l3) lastprivate (conditional: l3)
82 for (i = 0; i < 64; i++)
90 if ((fl & 1) && (((uintptr_t) &l2[0] | (uintptr_t) &l3) & 63) != 0)
93 #pragma omp for reduction(+:p[2:px], q[:3], r2) allocate(h: p, q, r2)
94 for (i = 0; i < 32; i++)
102 /* Can't really rely on alignment of &p[0], the implementation could
103 allocate the whole array or do what GCC does and allocate only part
105 if ((fl & 1) && (((uintptr_t) &q[0] | (uintptr_t) &r2[0]) & 63) != 0)
108 #pragma omp task private(y) firstprivate(x) allocate(x, y)
110 int *volatile p1 = &x;
111 int *volatile p2 = &y;
116 if (x != 43 || y != 21)
118 if ((fl & 2) && (((uintptr_t) p1 | (uintptr_t) p2) & 63) != 0)
121 #pragma omp task private(y) firstprivate(x) allocate(h: x, y)
123 int *volatile p1 = &x;
124 int *volatile p2 = &y;
129 if (x != 43 || y != 21)
131 if ((fl & 1) && (((uintptr_t) p1 | (uintptr_t) p2) & 63) != 0)
134 #pragma omp task private(y) firstprivate(s) allocate(s, y)
136 int *volatile p1 = &s.a;
137 int *volatile p2 = &s.b;
138 int *volatile p3 = &y;
139 if (s.a != 27 || s.b != 29)
144 if (s.a != 28 || s.b != 30 || y != 21)
146 if ((fl & 2) && (((uintptr_t) p1 | (uintptr_t) p3) & 63) != 0)
149 #pragma omp task private(y) firstprivate(s) allocate(h: s, y)
151 int *volatile p1 = &s.a;
152 int *volatile p2 = &s.b;
153 int *volatile p3 = &y;
154 if (s.a != 27 || s.b != 29)
159 if (s.a != 28 || s.b != 30 || y != 21)
161 if ((fl & 1) && (((uintptr_t) p1 | (uintptr_t) p3) & 63) != 0)
165 if (r != 64 * 63 / 2 || l != 63 || n != 8 + 16 * 64)
167 if (l2[0] != 63 || l2[1] != 63 + 1 || l2[2] != 63 + 2 || l2[3] != 63 + 3 || l3 != 36)
169 if (p[2] != (32 * 31) / 2 || p[3] != 2 * (32 * 31) / 2
170 || q[0] != 3 * (32 * 31) / 2 || q[2] != 4 * (32 * 31) / 2
171 || r2[0] != 5 * (32 * 31) / 2 || r2[3] != 6 * (32 * 31) / 2)
178 omp_alloctrait_t traits[3]
179 = { { omp_atk_alignment, 64 },
180 { omp_atk_fallback, omp_atv_null_fb } };
181 omp_allocator_handle_t a
182 = omp_init_allocator (omp_default_mem_space, 2, traits);
183 if (a == omp_null_allocator)
185 omp_set_default_allocator (omp_default_mem_alloc);
186 struct S s = { 27, 29 };
187 int p1[4], q1[3], px = 2;
190 int x = 42, y = 0, r = 0, l, l2[4], l3, n = 8;
191 foo (x, y, r, l, l2, l3, n, p, q, px, s, omp_null_allocator, 0);
192 x = 42; y = 0; r = 0; l = -1; l2[0] = -1; l2[1] = -1;
193 l2[2] = -1; l2[3] = -1; n = 8;
194 foo (x, y, r, l, l2, l3, n, p, q, px, s, omp_default_mem_alloc, 0);
195 x = 42; y = 0; r = 0; l = -1; l2[0] = -1; l2[1] = -1;
196 l2[2] = -1; l2[3] = -1; n = 8;
197 foo (x, y, r, l, l2, l3, n, p, q, px, s, a, 1);
198 x = 42; y = 0; r = 0; l = -1; l2[0] = -1; l2[1] = -1;
199 l2[2] = -1; l2[3] = -1; n = 8;
200 omp_set_default_allocator (a);
201 foo (x, y, r, l, l2, l3, n, p, q, px, s, omp_null_allocator, 3);
202 x = 42; y = 0; r = 0; l = -1; l2[0] = -1; l2[1] = -1;
203 l2[2] = -1; l2[3] = -1; n = 8;
204 foo (x, y, r, l, l2, l3, n, p, q, px, s, omp_default_mem_alloc, 2);
205 omp_destroy_allocator (a);