Lower zeroing array assignment to memset for allocatable arrays.
[official-gcc.git] / gcc / testsuite / c-c++-common / gomp / order-6.c
blob2127830e247f56d74f17f17b039ddcc3f0c468c2
1 void foo (void);
2 int v;
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
6 int omp_get_thread_num (void);
7 int omp_get_num_threads (void);
8 int omp_target_is_present (const void *, int);
9 int omp_get_cancellation (void);
10 #ifdef __cplusplus
12 #endif
14 void
15 f1 (int *a)
17 int i;
18 #pragma omp simd order(reproducible:concurrent)
19 for (i = 0; i < 64; i++)
21 #pragma omp parallel /* { dg-error "OpenMP constructs other than 'ordered simd', 'simd', 'loop' or 'atomic' may not be nested inside 'simd' region" } */
22 foo ();
24 #pragma omp simd order(reproducible:concurrent)
25 for (i = 0; i < 64; i++)
27 int j;
28 #pragma omp simd
29 for (j = 0; j < 64; j++)
30 a[64 * i + j] = i + j;
32 #pragma omp simd order(reproducible:concurrent)
33 for (i = 0; i < 64; i++)
35 #pragma omp critical /* { dg-error "OpenMP constructs other than 'ordered simd', 'simd', 'loop' or 'atomic' may not be nested inside 'simd' region" } */
36 foo ();
38 #pragma omp simd order(reproducible:concurrent)
39 for (i = 0; i < 64; i++)
41 #pragma omp ordered simd /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
42 foo ();
44 #pragma omp simd order(reproducible:concurrent)
45 for (i = 0; i < 64; i++)
47 #pragma omp atomic /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
48 v++;
50 #pragma omp simd order(reproducible:concurrent)
51 for (i = 0; i < 64; i++)
53 #pragma omp atomic read /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c++ } } */
54 a[i] = v; /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c } } */
56 #pragma omp simd order(reproducible:concurrent)
57 for (i = 0; i < 64; i++)
59 #pragma omp atomic write /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c++ } } */
60 v = a[i]; /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c } } */
62 #pragma omp simd order(reproducible:concurrent)
63 for (i = 0; i < 64; i++)
64 a[i] += omp_get_thread_num (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_thread_num\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
65 #pragma omp simd order(reproducible:concurrent)
66 for (i = 0; i < 64; i++)
67 a[i] += omp_get_num_threads (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_num_threads\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
68 #pragma omp simd order(reproducible:concurrent)
69 for (i = 0; i < 64; i++)
70 a[i] += omp_target_is_present (a + i, 0); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_target_is_present\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
71 #pragma omp simd order(reproducible:concurrent)
72 for (i = 0; i < 64; i++)
73 a[i] += omp_get_cancellation (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_cancellation\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
76 void
77 f2 (int *a)
79 int i;
80 #pragma omp for simd order(reproducible:concurrent)
81 for (i = 0; i < 64; i++)
83 #pragma omp parallel /* { dg-error "OpenMP constructs other than 'ordered simd', 'simd', 'loop' or 'atomic' may not be nested inside 'simd' region" } */
84 foo ();
86 #pragma omp for simd order(reproducible:concurrent)
87 for (i = 0; i < 64; i++)
89 int j;
90 #pragma omp simd
91 for (j = 0; j < 64; j++)
92 a[64 * i + j] = i + j;
94 #pragma omp for simd order(reproducible:concurrent)
95 for (i = 0; i < 64; i++)
97 #pragma omp critical /* { dg-error "OpenMP constructs other than 'ordered simd', 'simd', 'loop' or 'atomic' may not be nested inside 'simd' region" } */
98 foo ();
100 #pragma omp for simd order(reproducible:concurrent)
101 for (i = 0; i < 64; i++)
103 #pragma omp ordered simd /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
104 foo ();
106 #pragma omp for simd order(reproducible:concurrent)
107 for (i = 0; i < 64; i++)
109 #pragma omp atomic /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
110 v++;
112 #pragma omp for simd order(reproducible:concurrent)
113 for (i = 0; i < 64; i++)
115 #pragma omp atomic read /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c++ } } */
116 a[i] = v; /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c } } */
118 #pragma omp for simd order(reproducible:concurrent)
119 for (i = 0; i < 64; i++)
121 #pragma omp atomic write /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c++ } } */
122 v = a[i]; /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c } } */
124 #pragma omp for simd order(reproducible:concurrent)
125 for (i = 0; i < 64; i++)
126 a[i] += omp_get_thread_num (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_thread_num\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
127 #pragma omp for simd order(reproducible:concurrent)
128 for (i = 0; i < 64; i++)
129 a[i] += omp_get_num_threads (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_num_threads\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
130 #pragma omp for simd order(reproducible:concurrent)
131 for (i = 0; i < 64; i++)
132 a[i] += omp_target_is_present (a + i, 0); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_target_is_present\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
133 #pragma omp for simd order(reproducible:concurrent)
134 for (i = 0; i < 64; i++)
135 a[i] += omp_get_cancellation (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_cancellation\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
138 void
139 f3 (int *a)
141 int i;
142 #pragma omp for order(reproducible:concurrent)
143 for (i = 0; i < 64; i++)
145 #pragma omp parallel
146 foo ();
148 #pragma omp for order(reproducible:concurrent)
149 for (i = 0; i < 64; i++)
151 int j;
152 #pragma omp simd
153 for (j = 0; j < 64; j++)
154 a[64 * i + j] = i + j;
156 #pragma omp for order(reproducible:concurrent)
157 for (i = 0; i < 64; i++)
159 #pragma omp critical /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
160 foo ();
162 #pragma omp for order(reproducible:concurrent)
163 for (i = 0; i < 64; i++)
165 #pragma omp ordered simd /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
166 foo ();
168 #pragma omp for order(reproducible:concurrent)
169 for (i = 0; i < 64; i++)
171 #pragma omp atomic /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
172 v++;
174 #pragma omp for order(reproducible:concurrent)
175 for (i = 0; i < 64; i++)
177 #pragma omp atomic read /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c++ } } */
178 a[i] = v; /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c } } */
180 #pragma omp for order(reproducible:concurrent)
181 for (i = 0; i < 64; i++)
183 #pragma omp atomic write /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c++ } } */
184 v = a[i]; /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c } } */
186 #pragma omp for order(reproducible:concurrent)
187 for (i = 0; i < 64; i++)
189 #pragma omp task /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
190 a[i]++;
192 #pragma omp for order(reproducible:concurrent)
193 for (i = 0; i < 64; i++)
195 int j;
196 #pragma omp taskloop /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
197 for (j = 0; j < 64; j++)
198 a[64 * i + j] = i + j;
200 #pragma omp for order(reproducible:concurrent)
201 for (i = 0; i < 64; i++)
202 a[i] += omp_get_thread_num (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_thread_num\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
203 #pragma omp for order(reproducible:concurrent)
204 for (i = 0; i < 64; i++)
205 a[i] += omp_get_num_threads (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_num_threads\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
206 #pragma omp for order(reproducible:concurrent)
207 for (i = 0; i < 64; i++)
208 a[i] += omp_target_is_present (a + i, 0); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_target_is_present\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
209 #pragma omp for order(reproducible:concurrent)
210 for (i = 0; i < 64; i++)
211 a[i] += omp_get_cancellation (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_cancellation\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
214 void
215 f4 (int *a)
217 int i;
218 #pragma omp simd order(unconstrained:concurrent)
219 for (i = 0; i < 64; i++)
221 #pragma omp parallel /* { dg-error "OpenMP constructs other than 'ordered simd', 'simd', 'loop' or 'atomic' may not be nested inside 'simd' region" } */
222 foo ();
224 #pragma omp simd order(unconstrained:concurrent)
225 for (i = 0; i < 64; i++)
227 int j;
228 #pragma omp simd
229 for (j = 0; j < 64; j++)
230 a[64 * i + j] = i + j;
232 #pragma omp simd order(unconstrained:concurrent)
233 for (i = 0; i < 64; i++)
235 #pragma omp critical /* { dg-error "OpenMP constructs other than 'ordered simd', 'simd', 'loop' or 'atomic' may not be nested inside 'simd' region" } */
236 foo ();
238 #pragma omp simd order(unconstrained:concurrent)
239 for (i = 0; i < 64; i++)
241 #pragma omp ordered simd /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
242 foo ();
244 #pragma omp simd order(unconstrained:concurrent)
245 for (i = 0; i < 64; i++)
247 #pragma omp atomic /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
248 v++;
250 #pragma omp simd order(unconstrained:concurrent)
251 for (i = 0; i < 64; i++)
253 #pragma omp atomic read /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c++ } } */
254 a[i] = v; /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c } } */
256 #pragma omp simd order(unconstrained:concurrent)
257 for (i = 0; i < 64; i++)
259 #pragma omp atomic write /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c++ } } */
260 v = a[i]; /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c } } */
262 #pragma omp simd order(unconstrained:concurrent)
263 for (i = 0; i < 64; i++)
264 a[i] += omp_get_thread_num (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_thread_num\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
265 #pragma omp simd order(unconstrained:concurrent)
266 for (i = 0; i < 64; i++)
267 a[i] += omp_get_num_threads (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_num_threads\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
268 #pragma omp simd order(unconstrained:concurrent)
269 for (i = 0; i < 64; i++)
270 a[i] += omp_target_is_present (a + i, 0); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_target_is_present\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
271 #pragma omp simd order(unconstrained:concurrent)
272 for (i = 0; i < 64; i++)
273 a[i] += omp_get_cancellation (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_cancellation\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
276 void
277 f5 (int *a)
279 int i;
280 #pragma omp for simd order(unconstrained:concurrent)
281 for (i = 0; i < 64; i++)
283 #pragma omp parallel /* { dg-error "OpenMP constructs other than 'ordered simd', 'simd', 'loop' or 'atomic' may not be nested inside 'simd' region" } */
284 foo ();
286 #pragma omp for simd order(unconstrained:concurrent)
287 for (i = 0; i < 64; i++)
289 int j;
290 #pragma omp simd
291 for (j = 0; j < 64; j++)
292 a[64 * i + j] = i + j;
294 #pragma omp for simd order(unconstrained:concurrent)
295 for (i = 0; i < 64; i++)
297 #pragma omp critical /* { dg-error "OpenMP constructs other than 'ordered simd', 'simd', 'loop' or 'atomic' may not be nested inside 'simd' region" } */
298 foo ();
300 #pragma omp for simd order(unconstrained:concurrent)
301 for (i = 0; i < 64; i++)
303 #pragma omp ordered simd /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
304 foo ();
306 #pragma omp for simd order(unconstrained:concurrent)
307 for (i = 0; i < 64; i++)
309 #pragma omp atomic /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
310 v++;
312 #pragma omp for simd order(unconstrained:concurrent)
313 for (i = 0; i < 64; i++)
315 #pragma omp atomic read /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c++ } } */
316 a[i] = v; /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c } } */
318 #pragma omp for simd order(unconstrained:concurrent)
319 for (i = 0; i < 64; i++)
321 #pragma omp atomic write /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c++ } } */
322 v = a[i]; /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c } } */
324 #pragma omp for simd order(unconstrained:concurrent)
325 for (i = 0; i < 64; i++)
326 a[i] += omp_get_thread_num (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_thread_num\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
327 #pragma omp for simd order(unconstrained:concurrent)
328 for (i = 0; i < 64; i++)
329 a[i] += omp_get_num_threads (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_num_threads\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
330 #pragma omp for simd order(unconstrained:concurrent)
331 for (i = 0; i < 64; i++)
332 a[i] += omp_target_is_present (a + i, 0); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_target_is_present\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
333 #pragma omp for simd order(unconstrained:concurrent)
334 for (i = 0; i < 64; i++)
335 a[i] += omp_get_cancellation (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_cancellation\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
338 void
339 f6 (int *a)
341 int i;
342 #pragma omp for order(unconstrained:concurrent)
343 for (i = 0; i < 64; i++)
345 #pragma omp parallel
346 foo ();
348 #pragma omp for order(unconstrained:concurrent)
349 for (i = 0; i < 64; i++)
351 int j;
352 #pragma omp simd
353 for (j = 0; j < 64; j++)
354 a[64 * i + j] = i + j;
356 #pragma omp for order(unconstrained:concurrent)
357 for (i = 0; i < 64; i++)
359 #pragma omp critical /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
360 foo ();
362 #pragma omp for order(unconstrained:concurrent)
363 for (i = 0; i < 64; i++)
365 #pragma omp ordered simd /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
366 foo ();
368 #pragma omp for order(unconstrained:concurrent)
369 for (i = 0; i < 64; i++)
371 #pragma omp atomic /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
372 v++;
374 #pragma omp for order(unconstrained:concurrent)
375 for (i = 0; i < 64; i++)
377 #pragma omp atomic read /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c++ } } */
378 a[i] = v; /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c } } */
380 #pragma omp for order(unconstrained:concurrent)
381 for (i = 0; i < 64; i++)
383 #pragma omp atomic write /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c++ } } */
384 v = a[i]; /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c } } */
386 #pragma omp for order(unconstrained:concurrent)
387 for (i = 0; i < 64; i++)
389 #pragma omp task /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
390 a[i]++;
392 #pragma omp for order(unconstrained:concurrent)
393 for (i = 0; i < 64; i++)
395 int j;
396 #pragma omp taskloop /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
397 for (j = 0; j < 64; j++)
398 a[64 * i + j] = i + j;
400 #pragma omp for order(unconstrained:concurrent)
401 for (i = 0; i < 64; i++)
402 a[i] += omp_get_thread_num (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_thread_num\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
403 #pragma omp for order(unconstrained:concurrent)
404 for (i = 0; i < 64; i++)
405 a[i] += omp_get_num_threads (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_num_threads\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
406 #pragma omp for order(unconstrained:concurrent)
407 for (i = 0; i < 64; i++)
408 a[i] += omp_target_is_present (a + i, 0); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_target_is_present\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
409 #pragma omp for order(unconstrained:concurrent)
410 for (i = 0; i < 64; i++)
411 a[i] += omp_get_cancellation (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_cancellation\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */