Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / distribute_parallel_for_simd_misc_messages.c
bloba0f80e7ad1b21225a20a6e19a39f205cef9b6e58
1 // RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=45 -verify=expected,omp45 %s -Wuninitialized
2 // RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=50 -verify=expected,omp50 %s -Wuninitialized
3 // RUN: %clang_cc1 -fsyntax-only -fopenmp -verify=expected,omp51 %s -Wuninitialized
5 // RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=45 -verify=expected,omp45 %s -Wuninitialized
6 // RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=50 -verify=expected,omp50 %s -Wuninitialized
7 // RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -verify=expected,omp51 %s -Wuninitialized
9 void xxx(int argc) {
10 int x; // expected-note {{initialize the variable 'x' to silence this warning}}
11 #pragma omp distribute parallel for simd
12 for (int i = 0; i < 10; ++i)
13 argc = x; // expected-warning {{variable 'x' is uninitialized when used here}}
16 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp distribute parallel for simd'}}
17 #pragma omp distribute parallel for simd
19 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp distribute parallel for simd'}}
20 #pragma omp distribute parallel for simd foo
22 void test_no_clause(void) {
23 int i;
24 #pragma omp distribute parallel for simd
25 for (i = 0; i < 16; ++i)
28 // expected-error@+2 {{statement after '#pragma omp distribute parallel for simd' must be a for loop}}
29 #pragma omp distribute parallel for simd
30 ++i;
33 void test_branch_protected_scope(void) {
34 int i = 0;
35 L1:
36 ++i;
38 int x[24];
40 #pragma omp target
41 #pragma omp teams
42 #pragma omp distribute parallel for simd
43 for (i = 0; i < 16; ++i) {
44 if (i == 5)
45 goto L1; // expected-error {{use of undeclared label 'L1'}}
46 else if (i == 6)
47 return; // expected-error {{cannot return from OpenMP region}}
48 else if (i == 7)
49 goto L2;
50 else if (i == 8) {
51 L2:
52 x[i]++;
56 if (x[0] == 0)
57 goto L2; // expected-error {{use of undeclared label 'L2'}}
58 else if (x[1] == 1)
59 goto L1;
62 void test_invalid_clause(void) {
63 int i;
64 #pragma omp target
65 #pragma omp teams
66 // expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}}
67 #pragma omp distribute parallel for simd foo bar
68 for (i = 0; i < 16; ++i)
72 void test_non_identifiers(void) {
73 int i, x;
75 #pragma omp target
76 #pragma omp teams
77 // expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}}
78 #pragma omp distribute parallel for simd;
79 for (i = 0; i < 16; ++i)
81 #pragma omp target
82 #pragma omp teams
83 // expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}}
84 #pragma omp distribute parallel for simd firstprivate(x);
85 for (i = 0; i < 16; ++i)
88 #pragma omp target
89 #pragma omp teams
90 // expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}}
91 #pragma omp distribute parallel for simd private(x);
92 for (i = 0; i < 16; ++i)
95 #pragma omp target
96 #pragma omp teams
97 // expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}}
98 #pragma omp distribute parallel for simd, private(x);
99 for (i = 0; i < 16; ++i)
103 extern int foo(void);
104 void test_safelen(void) {
105 int i;
106 #pragma omp target
107 #pragma omp teams
108 // expected-error@+1 {{expected '('}}
109 #pragma omp distribute parallel for simd safelen
110 for (i = 0; i < 16; ++i)
112 #pragma omp target
113 #pragma omp teams
114 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
115 #pragma omp distribute parallel for simd safelen(
116 for (i = 0; i < 16; ++i)
118 #pragma omp target
119 #pragma omp teams
120 // expected-error@+1 {{expected expression}}
121 #pragma omp distribute parallel for simd safelen()
122 for (i = 0; i < 16; ++i)
124 #pragma omp target
125 #pragma omp teams
126 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
127 #pragma omp distribute parallel for simd safelen(,
128 for (i = 0; i < 16; ++i)
130 #pragma omp target
131 #pragma omp teams
132 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
133 #pragma omp distribute parallel for simd safelen(, )
134 for (i = 0; i < 16; ++i)
136 #pragma omp target
137 #pragma omp teams
138 // expected-warning@+2 {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}}
139 // expected-error@+1 {{expected '('}}
140 #pragma omp distribute parallel for simd safelen 4)
141 for (i = 0; i < 16; ++i)
143 #pragma omp target
144 #pragma omp teams
145 // expected-error@+2 {{expected ')'}}
146 // expected-note@+1 {{to match this '('}}
147 #pragma omp distribute parallel for simd safelen(4
148 for (i = 0; i < 16; ++i)
150 #pragma omp target
151 #pragma omp teams
152 // expected-error@+2 {{expected ')'}}
153 // expected-note@+1 {{to match this '('}}
154 #pragma omp distribute parallel for simd safelen(4,
155 for (i = 0; i < 16; ++i)
157 #pragma omp target
158 #pragma omp teams
159 // expected-error@+2 {{expected ')'}}
160 // expected-note@+1 {{to match this '('}}
161 #pragma omp distribute parallel for simd safelen(4, )
162 for (i = 0; i < 16; ++i)
164 #pragma omp target
165 #pragma omp teams
166 #pragma omp distribute parallel for simd safelen(4)
167 for (i = 0; i < 16; ++i)
169 #pragma omp target
170 #pragma omp teams
171 // expected-error@+2 {{expected ')'}}
172 // expected-note@+1 {{to match this '('}}
173 #pragma omp distribute parallel for simd safelen(4 4)
174 for (i = 0; i < 16; ++i)
176 #pragma omp target
177 #pragma omp teams
178 // expected-error@+2 {{expected ')'}}
179 // expected-note@+1 {{to match this '('}}
180 #pragma omp distribute parallel for simd safelen(4, , 4)
181 for (i = 0; i < 16; ++i)
183 #pragma omp target
184 #pragma omp teams
185 #pragma omp distribute parallel for simd safelen(4)
186 for (i = 0; i < 16; ++i)
188 #pragma omp target
189 #pragma omp teams
190 // expected-error@+2 {{expected ')'}}
191 // expected-note@+1 {{to match this '('}}
192 #pragma omp distribute parallel for simd safelen(4, 8)
193 for (i = 0; i < 16; ++i)
195 #pragma omp target
196 #pragma omp teams
197 // expected-error@+1 {{integer constant expression}}
198 #pragma omp distribute parallel for simd safelen(2.5)
199 for (i = 0; i < 16; ++i)
201 #pragma omp target
202 #pragma omp teams
203 // expected-error@+1 {{integer constant expression}}
204 #pragma omp distribute parallel for simd safelen(foo())
205 for (i = 0; i < 16; ++i)
207 #pragma omp target
208 #pragma omp teams
209 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
210 #pragma omp distribute parallel for simd safelen(-5)
211 for (i = 0; i < 16; ++i)
213 #pragma omp target
214 #pragma omp teams
215 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
216 #pragma omp distribute parallel for simd safelen(0)
217 for (i = 0; i < 16; ++i)
219 #pragma omp target
220 #pragma omp teams
221 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
222 #pragma omp distribute parallel for simd safelen(5 - 5)
223 for (i = 0; i < 16; ++i)
227 void test_simdlen(void) {
228 int i;
229 #pragma omp target
230 #pragma omp teams
231 // expected-error@+1 {{expected '('}}
232 #pragma omp distribute parallel for simd simdlen
233 for (i = 0; i < 16; ++i)
235 #pragma omp target
236 #pragma omp teams
237 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
238 #pragma omp distribute parallel for simd simdlen(
239 for (i = 0; i < 16; ++i)
241 #pragma omp target
242 #pragma omp teams
243 // expected-error@+1 {{expected expression}}
244 #pragma omp distribute parallel for simd simdlen()
245 for (i = 0; i < 16; ++i)
247 #pragma omp target
248 #pragma omp teams
249 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
250 #pragma omp distribute parallel for simd simdlen(,
251 for (i = 0; i < 16; ++i)
253 #pragma omp target
254 #pragma omp teams
255 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
256 #pragma omp distribute parallel for simd simdlen(, )
257 for (i = 0; i < 16; ++i)
259 #pragma omp target
260 #pragma omp teams
261 // expected-warning@+2 {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}}
262 // expected-error@+1 {{expected '('}}
263 #pragma omp distribute parallel for simd simdlen 4)
264 for (i = 0; i < 16; ++i)
266 #pragma omp target
267 #pragma omp teams
268 // expected-error@+2 {{expected ')'}}
269 // expected-note@+1 {{to match this '('}}
270 #pragma omp distribute parallel for simd simdlen(4
271 for (i = 0; i < 16; ++i)
273 #pragma omp target
274 #pragma omp teams
275 // expected-error@+2 {{expected ')'}}
276 // expected-note@+1 {{to match this '('}}
277 #pragma omp distribute parallel for simd simdlen(4,
278 for (i = 0; i < 16; ++i)
280 #pragma omp target
281 #pragma omp teams
282 // expected-error@+2 {{expected ')'}}
283 // expected-note@+1 {{to match this '('}}
284 #pragma omp distribute parallel for simd simdlen(4, )
285 for (i = 0; i < 16; ++i)
287 #pragma omp target
288 #pragma omp teams
289 #pragma omp distribute parallel for simd simdlen(4)
290 for (i = 0; i < 16; ++i)
292 #pragma omp target
293 #pragma omp teams
294 // expected-error@+2 {{expected ')'}}
295 // expected-note@+1 {{to match this '('}}
296 #pragma omp distribute parallel for simd simdlen(4 4)
297 for (i = 0; i < 16; ++i)
299 #pragma omp target
300 #pragma omp teams
301 // expected-error@+2 {{expected ')'}}
302 // expected-note@+1 {{to match this '('}}
303 #pragma omp distribute parallel for simd simdlen(4, , 4)
304 for (i = 0; i < 16; ++i)
306 #pragma omp target
307 #pragma omp teams
308 #pragma omp distribute parallel for simd simdlen(4)
309 for (i = 0; i < 16; ++i)
311 #pragma omp target
312 #pragma omp teams
313 // expected-error@+2 {{expected ')'}}
314 // expected-note@+1 {{to match this '('}}
315 #pragma omp distribute parallel for simd simdlen(4, 8)
316 for (i = 0; i < 16; ++i)
318 #pragma omp target
319 #pragma omp teams
320 // expected-error@+1 {{integer constant expression}}
321 #pragma omp distribute parallel for simd simdlen(2.5)
322 for (i = 0; i < 16; ++i)
324 #pragma omp target
325 #pragma omp teams
326 // expected-error@+1 {{integer constant expression}}
327 #pragma omp distribute parallel for simd simdlen(foo())
328 for (i = 0; i < 16; ++i)
330 #pragma omp target
331 #pragma omp teams
332 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
333 #pragma omp distribute parallel for simd simdlen(-5)
334 for (i = 0; i < 16; ++i)
336 #pragma omp target
337 #pragma omp teams
338 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
339 #pragma omp distribute parallel for simd simdlen(0)
340 for (i = 0; i < 16; ++i)
342 #pragma omp target
343 #pragma omp teams
344 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
345 #pragma omp distribute parallel for simd simdlen(5 - 5)
346 for (i = 0; i < 16; ++i)
350 void test_safelen_simdlen(void) {
351 int i;
352 #pragma omp target
353 #pragma omp teams
354 // expected-error@+1 {{the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter}}
355 #pragma omp distribute parallel for simd simdlen(6) safelen(5)
356 for (i = 0; i < 16; ++i)
359 #pragma omp target
360 #pragma omp teams
361 // expected-error@+1 {{the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter}}
362 #pragma omp distribute parallel for simd safelen(5) simdlen(6)
363 for (i = 0; i < 16; ++i)
367 void test_collapse(void) {
368 int i;
369 #pragma omp target
370 #pragma omp teams
371 // expected-error@+1 {{expected '('}}
372 #pragma omp distribute parallel for simd collapse
373 for (i = 0; i < 16; ++i)
375 #pragma omp target
376 #pragma omp teams
377 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
378 #pragma omp distribute parallel for simd collapse(
379 for (i = 0; i < 16; ++i)
381 #pragma omp target
382 #pragma omp teams
383 // expected-error@+1 {{expected expression}}
384 #pragma omp distribute parallel for simd collapse()
385 for (i = 0; i < 16; ++i)
387 #pragma omp target
388 #pragma omp teams
389 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
390 #pragma omp distribute parallel for simd collapse(,
391 for (i = 0; i < 16; ++i)
393 #pragma omp target
394 #pragma omp teams
395 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
396 #pragma omp distribute parallel for simd collapse(, )
397 for (i = 0; i < 16; ++i)
399 #pragma omp target
400 #pragma omp teams
401 // expected-warning@+2 {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}}
402 // expected-error@+1 {{expected '('}}
403 #pragma omp distribute parallel for simd collapse 4)
404 for (i = 0; i < 16; ++i)
406 #pragma omp target
407 #pragma omp teams
408 // expected-error@+2 {{expected ')'}}
409 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
410 #pragma omp distribute parallel for simd collapse(4
411 for (i = 0; i < 16; ++i)
412 ; // expected-error {{expected 4 for loops after '#pragma omp distribute parallel for simd', but found only 1}}
413 #pragma omp target
414 #pragma omp teams
415 // expected-error@+2 {{expected ')'}}
416 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
417 #pragma omp distribute parallel for simd collapse(4,
418 for (i = 0; i < 16; ++i)
419 ; // expected-error {{expected 4 for loops after '#pragma omp distribute parallel for simd', but found only 1}}
420 #pragma omp target
421 #pragma omp teams
422 // expected-error@+2 {{expected ')'}}
423 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
424 #pragma omp distribute parallel for simd collapse(4, )
425 for (i = 0; i < 16; ++i)
426 ; // expected-error {{expected 4 for loops after '#pragma omp distribute parallel for simd', but found only 1}}
427 #pragma omp target
428 #pragma omp teams
429 // expected-note@+1 {{as specified in 'collapse' clause}}
430 #pragma omp distribute parallel for simd collapse(4)
431 for (i = 0; i < 16; ++i)
432 ; // expected-error {{expected 4 for loops after '#pragma omp distribute parallel for simd', but found only 1}}
433 #pragma omp target
434 #pragma omp teams
435 // expected-error@+2 {{expected ')'}}
436 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
437 #pragma omp distribute parallel for simd collapse(4 4)
438 for (i = 0; i < 16; ++i)
439 ; // expected-error {{expected 4 for loops after '#pragma omp distribute parallel for simd', but found only 1}}
440 #pragma omp target
441 #pragma omp teams
442 // expected-error@+2 {{expected ')'}}
443 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
444 #pragma omp distribute parallel for simd collapse(4, , 4)
445 for (i = 0; i < 16; ++i)
446 ; // expected-error {{expected 4 for loops after '#pragma omp distribute parallel for simd', but found only 1}}
447 #pragma omp target
448 #pragma omp teams
449 #pragma omp distribute parallel for simd collapse(4)
450 for (int i1 = 0; i1 < 16; ++i1)
451 for (int i2 = 0; i2 < 16; ++i2)
452 for (int i3 = 0; i3 < 16; ++i3)
453 for (int i4 = 0; i4 < 16; ++i4)
454 foo();
455 #pragma omp target
456 #pragma omp teams
457 // expected-error@+2 {{expected ')'}}
458 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
459 #pragma omp distribute parallel for simd collapse(4, 8)
460 for (i = 0; i < 16; ++i)
461 ; // expected-error {{expected 4 for loops after '#pragma omp distribute parallel for simd', but found only 1}}
462 #pragma omp target
463 #pragma omp teams
464 // expected-error@+1 {{integer constant expression}}
465 #pragma omp distribute parallel for simd collapse(2.5)
466 for (i = 0; i < 16; ++i)
468 #pragma omp target
469 #pragma omp teams
470 // expected-error@+1 {{integer constant expression}}
471 #pragma omp distribute parallel for simd collapse(foo())
472 for (i = 0; i < 16; ++i)
474 #pragma omp target
475 #pragma omp teams
476 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
477 #pragma omp distribute parallel for simd collapse(-5)
478 for (i = 0; i < 16; ++i)
480 #pragma omp target
481 #pragma omp teams
482 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
483 #pragma omp distribute parallel for simd collapse(0)
484 for (i = 0; i < 16; ++i)
486 #pragma omp target
487 #pragma omp teams
488 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
489 #pragma omp distribute parallel for simd collapse(5 - 5)
490 for (i = 0; i < 16; ++i)
492 #pragma omp target
493 #pragma omp teams
494 #pragma omp distribute parallel for simd collapse(2)
495 for (i = 0; i < 16; ++i)
496 for (int j = 0; j < 16; ++j)
497 // expected-error@+1 {{OpenMP constructs may not be nested inside a simd region}}
498 #pragma omp distribute parallel for simd reduction(+ : i, j)
499 for (int k = 0; k < 16; ++k)
500 i += j;
503 void test_linear(void) {
504 int i;
505 #pragma omp target
506 #pragma omp teams
507 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
508 #pragma omp distribute parallel for simd linear(
509 for (i = 0; i < 16; ++i)
511 #pragma omp target
512 #pragma omp teams
513 // expected-error@+2 {{expected expression}}
514 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
515 #pragma omp distribute parallel for simd linear(,
516 for (i = 0; i < 16; ++i)
518 #pragma omp target
519 #pragma omp teams
520 // expected-error@+2 {{expected expression}}
521 // expected-error@+1 {{expected expression}}
522 #pragma omp distribute parallel for simd linear(, )
523 for (i = 0; i < 16; ++i)
525 #pragma omp target
526 #pragma omp teams
527 // expected-error@+1 {{expected expression}}
528 #pragma omp distribute parallel for simd linear()
529 for (i = 0; i < 16; ++i)
531 #pragma omp target
532 #pragma omp teams
533 // expected-error@+1 {{expected expression}}
534 #pragma omp distribute parallel for simd linear(int)
535 for (i = 0; i < 16; ++i)
537 #pragma omp target
538 #pragma omp teams
539 // expected-error@+1 {{expected variable name}}
540 #pragma omp distribute parallel for simd linear(0)
541 for (i = 0; i < 16; ++i)
543 #pragma omp target
544 #pragma omp teams
545 // expected-error@+1 {{use of undeclared identifier 'x'}}
546 #pragma omp distribute parallel for simd linear(x)
547 for (i = 0; i < 16; ++i)
549 #pragma omp target
550 #pragma omp teams
551 // expected-error@+2 {{use of undeclared identifier 'x'}}
552 // expected-error@+1 {{use of undeclared identifier 'y'}}
553 #pragma omp distribute parallel for simd linear(x, y)
554 for (i = 0; i < 16; ++i)
556 #pragma omp target
557 #pragma omp teams
558 // expected-error@+3 {{use of undeclared identifier 'x'}}
559 // expected-error@+2 {{use of undeclared identifier 'y'}}
560 // expected-error@+1 {{use of undeclared identifier 'z'}}
561 #pragma omp distribute parallel for simd linear(x, y, z)
562 for (i = 0; i < 16; ++i)
566 void test_aligned(void) {
567 int i;
568 #pragma omp target
569 #pragma omp teams
570 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
571 #pragma omp distribute parallel for simd aligned(
572 for (i = 0; i < 16; ++i)
574 // expected-error@+2 {{expected expression}}
575 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
576 #pragma omp distribute parallel for simd aligned(,
577 for (i = 0; i < 16; ++i)
579 #pragma omp target
580 #pragma omp teams
581 // expected-error@+2 {{expected expression}}
582 // expected-error@+1 {{expected expression}}
583 #pragma omp distribute parallel for simd aligned(, )
584 for (i = 0; i < 16; ++i)
586 #pragma omp target
587 #pragma omp teams
588 // expected-error@+1 {{expected expression}}
589 #pragma omp distribute parallel for simd aligned()
590 for (i = 0; i < 16; ++i)
592 #pragma omp target
593 #pragma omp teams
594 // expected-error@+1 {{expected expression}}
595 #pragma omp distribute parallel for simd aligned(int)
596 for (i = 0; i < 16; ++i)
598 #pragma omp target
599 #pragma omp teams
600 // expected-error@+1 {{expected variable name}}
601 #pragma omp distribute parallel for simd aligned(0)
602 for (i = 0; i < 16; ++i)
604 #pragma omp target
605 #pragma omp teams
606 // expected-error@+1 {{use of undeclared identifier 'x'}}
607 #pragma omp distribute parallel for simd aligned(x)
608 for (i = 0; i < 16; ++i)
610 #pragma omp target
611 #pragma omp teams
612 // expected-error@+2 {{use of undeclared identifier 'x'}}
613 // expected-error@+1 {{use of undeclared identifier 'y'}}
614 #pragma omp distribute parallel for simd aligned(x, y)
615 for (i = 0; i < 16; ++i)
617 #pragma omp target
618 #pragma omp teams
619 // expected-error@+3 {{use of undeclared identifier 'x'}}
620 // expected-error@+2 {{use of undeclared identifier 'y'}}
621 // expected-error@+1 {{use of undeclared identifier 'z'}}
622 #pragma omp distribute parallel for simd aligned(x, y, z)
623 for (i = 0; i < 16; ++i)
626 int *x, y, z[25]; // expected-note 4 {{'y' defined here}}
627 #pragma omp target
628 #pragma omp teams
629 #pragma omp distribute parallel for simd aligned(x)
630 for (i = 0; i < 16; ++i)
632 #pragma omp target
633 #pragma omp teams
634 #pragma omp distribute parallel for simd aligned(z)
635 for (i = 0; i < 16; ++i)
637 #pragma omp target
638 #pragma omp teams
639 // expected-error@+1 {{expected expression}}
640 #pragma omp distribute parallel for simd aligned(x :)
641 for (i = 0; i < 16; ++i)
643 #pragma omp target
644 #pragma omp teams
645 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
646 #pragma omp distribute parallel for simd aligned(x :, )
647 for (i = 0; i < 16; ++i)
649 #pragma omp target
650 #pragma omp teams
651 #pragma omp distribute parallel for simd aligned(x : 1)
652 for (i = 0; i < 16; ++i)
654 #pragma omp target
655 #pragma omp teams
656 #pragma omp distribute parallel for simd aligned(x : 2 * 2)
657 for (i = 0; i < 16; ++i)
659 #pragma omp target
660 #pragma omp teams
661 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
662 #pragma omp distribute parallel for simd aligned(x : 1, y)
663 for (i = 0; i < 16; ++i)
665 #pragma omp target
666 #pragma omp teams
667 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
668 #pragma omp distribute parallel for simd aligned(x : 1, y, z : 1)
669 for (i = 0; i < 16; ++i)
672 #pragma omp target
673 #pragma omp teams
674 // expected-error@+1 {{argument of aligned clause should be array or pointer, not 'int'}}
675 #pragma omp distribute parallel for simd aligned(x, y)
676 for (i = 0; i < 16; ++i)
678 #pragma omp target
679 #pragma omp teams
680 // expected-error@+1 {{argument of aligned clause should be array or pointer, not 'int'}}
681 #pragma omp distribute parallel for simd aligned(x, y, z)
682 for (i = 0; i < 16; ++i)
685 #pragma omp target
686 #pragma omp teams
687 // expected-note@+2 {{defined as aligned}}
688 // expected-error@+1 {{a variable cannot appear in more than one aligned clause}}
689 #pragma omp distribute parallel for simd aligned(x) aligned(z, x)
690 for (i = 0; i < 16; ++i)
693 #pragma omp target
694 #pragma omp teams
695 // expected-note@+3 {{defined as aligned}}
696 // expected-error@+2 {{a variable cannot appear in more than one aligned clause}}
697 // expected-error@+1 2 {{argument of aligned clause should be array or pointer, not 'int'}}
698 #pragma omp distribute parallel for simd aligned(x, y, z) aligned(y, z)
699 for (i = 0; i < 16; ++i)
704 void test_private(void) {
705 int i;
706 #pragma omp target
707 #pragma omp teams
708 // expected-error@+2 {{expected expression}}
709 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
710 #pragma omp distribute parallel for simd private(
711 for (i = 0; i < 16; ++i)
713 #pragma omp target
714 #pragma omp teams
715 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
716 // expected-error@+1 2 {{expected expression}}
717 #pragma omp distribute parallel for simd private(,
718 for (i = 0; i < 16; ++i)
720 #pragma omp target
721 #pragma omp teams
722 // expected-error@+1 2 {{expected expression}}
723 #pragma omp distribute parallel for simd private(, )
724 for (i = 0; i < 16; ++i)
726 #pragma omp target
727 #pragma omp teams
728 // expected-error@+1 {{expected expression}}
729 #pragma omp distribute parallel for simd private()
730 for (i = 0; i < 16; ++i)
732 #pragma omp target
733 #pragma omp teams
734 // expected-error@+1 {{expected expression}}
735 #pragma omp distribute parallel for simd private(int)
736 for (i = 0; i < 16; ++i)
738 #pragma omp target
739 #pragma omp teams
740 // expected-error@+1 {{expected variable name}}
741 #pragma omp distribute parallel for simd private(0)
742 for (i = 0; i < 16; ++i)
745 int x, y, z;
746 #pragma omp target
747 #pragma omp teams
748 #pragma omp distribute parallel for simd private(x)
749 for (i = 0; i < 16; ++i)
751 #pragma omp target
752 #pragma omp teams
753 #pragma omp distribute parallel for simd private(x, y)
754 for (i = 0; i < 16; ++i)
756 #pragma omp target
757 #pragma omp teams
758 #pragma omp distribute parallel for simd private(x, y, z)
759 for (i = 0; i < 16; ++i) {
760 x = y * i + z;
764 void test_lastprivate(void) {
765 int i;
766 #pragma omp target
767 #pragma omp teams
768 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
769 // expected-error@+1 {{expected expression}}
770 #pragma omp distribute parallel for simd lastprivate(
771 for (i = 0; i < 16; ++i)
774 #pragma omp target
775 #pragma omp teams
776 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
777 // expected-error@+1 2 {{expected expression}}
778 #pragma omp distribute parallel for simd lastprivate(,
779 for (i = 0; i < 16; ++i)
781 #pragma omp target
782 #pragma omp teams
783 // expected-error@+1 2 {{expected expression}}
784 #pragma omp distribute parallel for simd lastprivate(, )
785 for (i = 0; i < 16; ++i)
787 #pragma omp target
788 #pragma omp teams
789 // expected-error@+1 {{expected expression}}
790 #pragma omp distribute parallel for simd lastprivate()
791 for (i = 0; i < 16; ++i)
793 #pragma omp target
794 #pragma omp teams
795 // expected-error@+1 {{expected expression}}
796 #pragma omp distribute parallel for simd lastprivate(int)
797 for (i = 0; i < 16; ++i)
799 #pragma omp target
800 #pragma omp teams
801 // expected-error@+1 {{expected variable name}}
802 #pragma omp distribute parallel for simd lastprivate(0)
803 for (i = 0; i < 16; ++i)
806 int x, y, z;
807 #pragma omp target
808 #pragma omp teams
809 #pragma omp distribute parallel for simd lastprivate(x)
810 for (i = 0; i < 16; ++i)
812 #pragma omp target
813 #pragma omp teams
814 #pragma omp distribute parallel for simd lastprivate(x, y)
815 for (i = 0; i < 16; ++i)
817 #pragma omp target
818 #pragma omp teams
819 #pragma omp distribute parallel for simd lastprivate(x, y, z)
820 for (i = 0; i < 16; ++i)
824 void test_firstprivate(void) {
825 int i;
826 #pragma omp target
827 #pragma omp teams
828 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
829 // expected-error@+1 {{expected expression}}
830 #pragma omp distribute parallel for simd firstprivate(
831 for (i = 0; i < 16; ++i)
834 #pragma omp target
835 #pragma omp teams
836 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
837 // expected-error@+1 2 {{expected expression}}
838 #pragma omp distribute parallel for simd firstprivate(,
839 for (i = 0; i < 16; ++i)
841 #pragma omp target
842 #pragma omp teams
843 // expected-error@+1 2 {{expected expression}}
844 #pragma omp distribute parallel for simd firstprivate(, )
845 for (i = 0; i < 16; ++i)
847 #pragma omp target
848 #pragma omp teams
849 // expected-error@+1 {{expected expression}}
850 #pragma omp distribute parallel for simd firstprivate()
851 for (i = 0; i < 16; ++i)
853 #pragma omp target
854 #pragma omp teams
855 // expected-error@+1 {{expected expression}}
856 #pragma omp distribute parallel for simd firstprivate(int)
857 for (i = 0; i < 16; ++i)
859 #pragma omp target
860 #pragma omp teams
861 // expected-error@+1 {{expected variable name}}
862 #pragma omp distribute parallel for simd firstprivate(0)
863 for (i = 0; i < 16; ++i)
866 int x, y, z;
867 // expected-error@+3 {{lastprivate variable cannot be firstprivate}} expected-note@+3 {{defined as lastprivate}}
868 #pragma omp target
869 #pragma omp teams
870 #pragma omp distribute parallel for simd lastprivate(x) firstprivate(x)
871 for (i = 0; i < 16; ++i)
873 // expected-error@+3 2 {{lastprivate variable cannot be firstprivate}} expected-note@+3 2 {{defined as lastprivate}}
874 #pragma omp target
875 #pragma omp teams
876 #pragma omp distribute parallel for simd lastprivate(x, y) firstprivate(x, y)
877 for (i = 0; i < 16; ++i)
879 // expected-error@+3 3 {{lastprivate variable cannot be firstprivate}} expected-note@+3 3 {{defined as lastprivate}}
880 #pragma omp target
881 #pragma omp teams
882 #pragma omp distribute parallel for simd lastprivate(x, y, z) firstprivate(x, y, z)
883 for (i = 0; i < 16; ++i)
887 void test_loop_messages(void) {
888 float a[100], b[100], c[100];
889 #pragma omp target
890 #pragma omp teams
891 // expected-error@+2 {{variable must be of integer or pointer type}}
892 #pragma omp distribute parallel for simd
893 for (float fi = 0; fi < 10.0; fi++) {
894 c[(int)fi] = a[(int)fi] + b[(int)fi];
896 #pragma omp target
897 #pragma omp teams
898 // expected-error@+2 {{variable must be of integer or pointer type}}
899 #pragma omp distribute parallel for simd
900 for (double fi = 0; fi < 10.0; fi++) {
901 c[(int)fi] = a[(int)fi] + b[(int)fi];
905 void test_nontemporal(void) {
906 int i;
907 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
908 #pragma omp distribute parallel for simd nontemporal(
909 for (i = 0; i < 16; ++i)
911 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} expected-error@+1 2 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
912 #pragma omp distribute parallel for simd nontemporal(,
913 for (i = 0; i < 16; ++i)
915 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} expected-error@+1 2 {{expected expression}}
916 #pragma omp distribute parallel for simd nontemporal(, )
917 for (i = 0; i < 16; ++i)
919 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} expected-error@+1 {{expected expression}}
920 #pragma omp distribute parallel for simd nontemporal()
921 for (i = 0; i < 16; ++i)
923 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} expected-error@+1 {{expected expression}}
924 #pragma omp distribute parallel for simd nontemporal(int)
925 for (i = 0; i < 16; ++i)
927 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} omp50-error@+1 {{expected variable name}} omp51-error@+1 {{expected variable name}}
928 #pragma omp distribute parallel for simd nontemporal(0)
929 for (i = 0; i < 16; ++i)
931 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} expected-error@+1 {{use of undeclared identifier 'x'}}
932 #pragma omp distribute parallel for simd nontemporal(x)
933 for (i = 0; i < 16; ++i)
935 // expected-error@+2 {{use of undeclared identifier 'x'}}
936 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} expected-error@+1 {{use of undeclared identifier 'y'}}
937 #pragma omp distribute parallel for simd nontemporal(x, y)
938 for (i = 0; i < 16; ++i)
940 // expected-error@+3 {{use of undeclared identifier 'x'}}
941 // expected-error@+2 {{use of undeclared identifier 'y'}}
942 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} expected-error@+1 {{use of undeclared identifier 'z'}}
943 #pragma omp distribute parallel for simd nontemporal(x, y, z)
944 for (i = 0; i < 16; ++i)
947 int x, y;
948 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} expected-error@+1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
949 #pragma omp distribute parallel for simd nontemporal(x :)
950 for (i = 0; i < 16; ++i)
952 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} expected-error@+1 {{expected ',' or ')' in 'nontemporal' clause}}
953 #pragma omp distribute parallel for simd nontemporal(x :, )
954 for (i = 0; i < 16; ++i)
957 // omp51-note@+3 {{defined as nontemporal}}
958 // omp50-note@+2 {{defined as nontemporal}}
959 // omp45-error@+1 2 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} omp50-error@+1 {{a variable cannot appear in more than one nontemporal clause}} omp51-error@+1 {{a variable cannot appear in more than one nontemporal clause}}
960 #pragma omp distribute parallel for simd nontemporal(x) nontemporal(x)
961 for (i = 0; i < 16; ++i)
964 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}}
965 #pragma omp distribute parallel for simd private(x) nontemporal(x)
966 for (i = 0; i < 16; ++i)
969 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}}
970 #pragma omp distribute parallel for simd nontemporal(x) private(x)
971 for (i = 0; i < 16; ++i)
974 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} expected-note@+1 {{to match this '('}} expected-error@+1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error@+1 {{expected ')'}}
975 #pragma omp distribute parallel for simd nontemporal(x, y : 0)
976 for (i = 0; i < 16; ++i)
979 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}}
980 #pragma omp distribute parallel for simd nontemporal(x) lastprivate(x)
981 for (i = 0; i < 16; ++i)
984 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}}
985 #pragma omp distribute parallel for simd lastprivate(x) nontemporal(x)
986 for (i = 0; i < 16; ++i)
988 #pragma omp distribute parallel for simd order // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute parallel for simd'}} expected-error {{expected '(' after 'order'}}
989 for (int i = 0; i < 10; ++i)
991 #pragma omp distribute parallel for simd order( // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute parallel for simd'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}} omp51-error {{expected 'concurrent' in OpenMP clause 'order'}}
992 for (int i = 0; i < 10; ++i)
994 #pragma omp distribute parallel for simd order(none // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute parallel for simd'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}} omp51-error {{expected 'concurrent' in OpenMP clause 'order'}}
995 for (int i = 0; i < 10; ++i)
997 #pragma omp distribute parallel for simd order(concurrent // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute parallel for simd'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
998 for (int i = 0; i < 10; ++i)
1000 #pragma omp distribute parallel for simd order(concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute parallel for simd'}}
1001 for (int i = 0; i < 10; ++i)
1003 #pragma omp distribute parallel for simd order(unconstrained:) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute parallel for simd'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}} omp51-error {{expected 'concurrent' in OpenMP clause 'order'}}
1004 for (int i = 0; i < 10; ++i)
1006 #pragma omp distribute parallel for simd order(reproducible:concurrent // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute parallel for simd'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
1007 for (int i = 0; i < 10; ++i)
1009 #pragma omp distribute parallel for simd order(reproducible:concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute parallel for simd'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
1010 for (int i = 0; i < 10; ++i)
1012 #pragma omp distribute parallel for simd order(unconstrained:concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute parallel for simd'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
1013 for (int i = 0; i < 10; ++i)
1015 #pragma omp distribute parallel for simd order(concurrent) order(concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute parallel for simd'}} omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute parallel for simd'}} omp51-error {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'order' clause}}
1016 for (int i = 0; i < 10; ++i)