Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / distribute_simd_misc_messages.c
blobf78b0ea8c56ce788ca0aab25350d200804842ab3
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 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 simd'}}
17 #pragma omp distribute simd
19 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp distribute simd'}}
20 #pragma omp distribute simd foo
22 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp distribute simd'}}
23 #pragma omp distribute simd safelen(4)
25 void test_no_clause(void) {
26 int i;
27 #pragma omp target
28 #pragma omp teams
29 #pragma omp distribute simd
30 for (i = 0; i < 16; ++i)
33 #pragma omp target
34 #pragma omp teams
35 // expected-error@+2 {{statement after '#pragma omp distribute simd' must be a for loop}}
36 #pragma omp distribute simd
37 ++i;
40 void test_branch_protected_scope(void) {
41 int i = 0;
42 L1:
43 ++i;
45 int x[24];
47 #pragma omp target
48 #pragma omp teams
49 #pragma omp distribute simd
50 for (i = 0; i < 16; ++i) {
51 if (i == 5)
52 goto L1; // expected-error {{use of undeclared label 'L1'}}
53 else if (i == 6)
54 return; // expected-error {{cannot return from OpenMP region}}
55 else if (i == 7)
56 goto L2;
57 else if (i == 8) {
58 L2:
59 x[i]++;
63 if (x[0] == 0)
64 goto L2; // expected-error {{use of undeclared label 'L2'}}
65 else if (x[1] == 1)
66 goto L1;
69 void test_invalid_clause(void) {
70 int i;
71 #pragma omp target
72 #pragma omp teams
73 // expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute simd' are ignored}}
74 #pragma omp distribute simd foo bar
75 for (i = 0; i < 16; ++i)
79 void test_non_identifiers(void) {
80 int i, x;
82 #pragma omp target
83 #pragma omp teams
84 // expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute simd' are ignored}}
85 #pragma omp distribute simd;
86 for (i = 0; i < 16; ++i)
89 #pragma omp target
90 #pragma omp teams
91 // expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute simd' are ignored}}
92 #pragma omp distribute simd private(x);
93 for (i = 0; i < 16; ++i)
96 #pragma omp target
97 #pragma omp teams
98 // expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute simd' are ignored}}
99 #pragma omp distribute simd, private(x);
100 for (i = 0; i < 16; ++i)
104 extern int foo(void);
105 void test_safelen(void) {
106 int i;
107 #pragma omp target
108 #pragma omp teams
109 // expected-error@+1 {{expected '('}}
110 #pragma omp distribute simd safelen
111 for (i = 0; i < 16; ++i)
113 #pragma omp target
114 #pragma omp teams
115 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
116 #pragma omp distribute simd safelen(
117 for (i = 0; i < 16; ++i)
119 #pragma omp target
120 #pragma omp teams
121 // expected-error@+1 {{expected expression}}
122 #pragma omp distribute simd safelen()
123 for (i = 0; i < 16; ++i)
125 #pragma omp target
126 #pragma omp teams
127 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
128 #pragma omp distribute simd safelen(,
129 for (i = 0; i < 16; ++i)
131 #pragma omp target
132 #pragma omp teams
133 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
134 #pragma omp distribute simd safelen(, )
135 for (i = 0; i < 16; ++i)
137 #pragma omp target
138 #pragma omp teams
139 // expected-warning@+2 {{extra tokens at the end of '#pragma omp distribute simd' are ignored}}
140 // expected-error@+1 {{expected '('}}
141 #pragma omp distribute simd safelen 4)
142 for (i = 0; i < 16; ++i)
144 #pragma omp target
145 #pragma omp teams
146 // expected-error@+2 {{expected ')'}}
147 // expected-note@+1 {{to match this '('}}
148 #pragma omp distribute simd safelen(4
149 for (i = 0; i < 16; ++i)
151 #pragma omp target
152 #pragma omp teams
153 // expected-error@+2 {{expected ')'}}
154 // expected-note@+1 {{to match this '('}}
155 #pragma omp distribute simd safelen(4,
156 for (i = 0; i < 16; ++i)
158 #pragma omp target
159 #pragma omp teams
160 // expected-error@+2 {{expected ')'}}
161 // expected-note@+1 {{to match this '('}}
162 #pragma omp distribute simd safelen(4, )
163 for (i = 0; i < 16; ++i)
165 #pragma omp target
166 #pragma omp teams
167 // xxpected-error@+1 {{expected expression}}
168 #pragma omp distribute simd safelen(4)
169 for (i = 0; i < 16; ++i)
171 #pragma omp target
172 #pragma omp teams
173 // expected-error@+2 {{expected ')'}}
174 // expected-note@+1 {{to match this '('}}
175 #pragma omp distribute simd safelen(4 4)
176 for (i = 0; i < 16; ++i)
178 #pragma omp target
179 #pragma omp teams
180 // expected-error@+2 {{expected ')'}}
181 // expected-note@+1 {{to match this '('}}
182 #pragma omp distribute simd safelen(4, , 4)
183 for (i = 0; i < 16; ++i)
185 #pragma omp target
186 #pragma omp teams
187 #pragma omp distribute simd safelen(4)
188 for (i = 0; i < 16; ++i)
190 #pragma omp target
191 #pragma omp teams
192 // expected-error@+2 {{expected ')'}}
193 // expected-note@+1 {{to match this '('}}
194 #pragma omp distribute simd safelen(4, 8)
195 for (i = 0; i < 16; ++i)
197 #pragma omp target
198 #pragma omp teams
199 // expected-error@+1 {{integer constant expression}}
200 #pragma omp distribute simd safelen(2.5)
201 for (i = 0; i < 16; ++i)
203 #pragma omp target
204 #pragma omp teams
205 // expected-error@+1 {{integer constant expression}}
206 #pragma omp distribute simd safelen(foo())
207 for (i = 0; i < 16; ++i)
209 #pragma omp target
210 #pragma omp teams
211 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
212 #pragma omp distribute simd safelen(-5)
213 for (i = 0; i < 16; ++i)
215 #pragma omp target
216 #pragma omp teams
217 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
218 #pragma omp distribute simd safelen(0)
219 for (i = 0; i < 16; ++i)
221 #pragma omp target
222 #pragma omp teams
223 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
224 #pragma omp distribute simd safelen(5 - 5)
225 for (i = 0; i < 16; ++i)
229 void test_simdlen(void) {
230 int i;
231 #pragma omp target
232 #pragma omp teams
233 // expected-error@+1 {{expected '('}}
234 #pragma omp distribute simd simdlen
235 for (i = 0; i < 16; ++i)
237 #pragma omp target
238 #pragma omp teams
239 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
240 #pragma omp distribute simd simdlen(
241 for (i = 0; i < 16; ++i)
243 #pragma omp target
244 #pragma omp teams
245 // expected-error@+1 {{expected expression}}
246 #pragma omp distribute simd simdlen()
247 for (i = 0; i < 16; ++i)
249 #pragma omp target
250 #pragma omp teams
251 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
252 #pragma omp distribute simd simdlen(,
253 for (i = 0; i < 16; ++i)
255 #pragma omp target
256 #pragma omp teams
257 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
258 #pragma omp distribute simd simdlen(, )
259 for (i = 0; i < 16; ++i)
261 #pragma omp target
262 #pragma omp teams
263 // expected-warning@+2 {{extra tokens at the end of '#pragma omp distribute simd' are ignored}}
264 // expected-error@+1 {{expected '('}}
265 #pragma omp distribute simd simdlen 4)
266 for (i = 0; i < 16; ++i)
268 #pragma omp target
269 #pragma omp teams
270 // expected-error@+2 {{expected ')'}}
271 // expected-note@+1 {{to match this '('}}
272 #pragma omp distribute simd simdlen(4
273 for (i = 0; i < 16; ++i)
275 #pragma omp target
276 #pragma omp teams
277 // expected-error@+2 {{expected ')'}}
278 // expected-note@+1 {{to match this '('}}
279 #pragma omp distribute simd simdlen(4,
280 for (i = 0; i < 16; ++i)
282 #pragma omp target
283 #pragma omp teams
284 // expected-error@+2 {{expected ')'}}
285 // expected-note@+1 {{to match this '('}}
286 #pragma omp distribute simd simdlen(4, )
287 for (i = 0; i < 16; ++i)
289 #pragma omp target
290 #pragma omp teams
291 #pragma omp distribute simd simdlen(4)
292 for (i = 0; i < 16; ++i)
294 #pragma omp target
295 #pragma omp teams
296 // expected-error@+2 {{expected ')'}}
297 // expected-note@+1 {{to match this '('}}
298 #pragma omp distribute simd simdlen(4 4)
299 for (i = 0; i < 16; ++i)
301 #pragma omp target
302 #pragma omp teams
303 // expected-error@+2 {{expected ')'}}
304 // expected-note@+1 {{to match this '('}}
305 #pragma omp distribute simd simdlen(4, , 4)
306 for (i = 0; i < 16; ++i)
308 #pragma omp target
309 #pragma omp teams
310 #pragma omp distribute simd simdlen(4)
311 for (i = 0; i < 16; ++i)
313 #pragma omp target
314 #pragma omp teams
315 // expected-error@+2 {{expected ')'}}
316 // expected-note@+1 {{to match this '('}}
317 #pragma omp distribute simd simdlen(4, 8)
318 for (i = 0; i < 16; ++i)
320 #pragma omp target
321 #pragma omp teams
322 // expected-error@+1 {{integer constant expression}}
323 #pragma omp distribute simd simdlen(2.5)
324 for (i = 0; i < 16; ++i)
326 #pragma omp target
327 #pragma omp teams
328 // expected-error@+1 {{integer constant expression}}
329 #pragma omp distribute simd simdlen(foo())
330 for (i = 0; i < 16; ++i)
332 #pragma omp target
333 #pragma omp teams
334 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
335 #pragma omp distribute simd simdlen(-5)
336 for (i = 0; i < 16; ++i)
338 #pragma omp target
339 #pragma omp teams
340 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
341 #pragma omp distribute simd simdlen(0)
342 for (i = 0; i < 16; ++i)
344 #pragma omp target
345 #pragma omp teams
346 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
347 #pragma omp distribute simd simdlen(5 - 5)
348 for (i = 0; i < 16; ++i)
352 void test_safelen_simdlen(void) {
353 int i;
354 #pragma omp target
355 #pragma omp teams
356 // expected-error@+1 {{the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter}}
357 #pragma omp distribute simd simdlen(6) safelen(5)
358 for (i = 0; i < 16; ++i)
361 #pragma omp target
362 #pragma omp teams
363 // expected-error@+1 {{the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter}}
364 #pragma omp distribute simd safelen(5) simdlen(6)
365 for (i = 0; i < 16; ++i)
369 void test_collapse(void) {
370 int i;
371 #pragma omp target
372 #pragma omp teams
373 // expected-error@+1 {{expected '('}}
374 #pragma omp distribute simd collapse
375 for (i = 0; i < 16; ++i)
377 #pragma omp target
378 #pragma omp teams
379 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
380 #pragma omp distribute simd collapse(
381 for (i = 0; i < 16; ++i)
383 #pragma omp target
384 #pragma omp teams
385 // expected-error@+1 {{expected expression}}
386 #pragma omp distribute simd collapse()
387 for (i = 0; i < 16; ++i)
389 #pragma omp target
390 #pragma omp teams
391 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
392 #pragma omp distribute simd collapse(,
393 for (i = 0; i < 16; ++i)
395 #pragma omp target
396 #pragma omp teams
397 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
398 #pragma omp distribute simd collapse(, )
399 for (i = 0; i < 16; ++i)
401 #pragma omp target
402 #pragma omp teams
403 // expected-warning@+2 {{extra tokens at the end of '#pragma omp distribute simd' are ignored}}
404 // expected-error@+1 {{expected '('}}
405 #pragma omp distribute simd collapse 4)
406 for (i = 0; i < 16; ++i)
408 #pragma omp target
409 #pragma omp teams
410 // expected-error@+2 {{expected ')'}}
411 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
412 #pragma omp distribute simd collapse(4
413 for (i = 0; i < 16; ++i)
414 ; // expected-error {{expected 4 for loops after '#pragma omp distribute simd', but found only 1}}
415 #pragma omp target
416 #pragma omp teams
417 // expected-error@+2 {{expected ')'}}
418 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
419 #pragma omp distribute simd collapse(4,
420 for (i = 0; i < 16; ++i)
421 ; // expected-error {{expected 4 for loops after '#pragma omp distribute simd', but found only 1}}
422 #pragma omp target
423 #pragma omp teams
424 // expected-error@+2 {{expected ')'}}
425 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
426 #pragma omp distribute simd collapse(4, )
427 for (i = 0; i < 16; ++i)
428 ; // expected-error {{expected 4 for loops after '#pragma omp distribute simd', but found only 1}}
429 #pragma omp target
430 #pragma omp teams
431 // xxpected-error@+1 {{expected expression}} expected-note@+1 {{as specified in 'collapse' clause}}
432 #pragma omp distribute simd collapse(4)
433 for (i = 0; i < 16; ++i)
434 ; // expected-error {{expected 4 for loops after '#pragma omp distribute simd', but found only 1}}
435 #pragma omp target
436 #pragma omp teams
437 // expected-error@+2 {{expected ')'}}
438 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
439 #pragma omp distribute simd collapse(4 4)
440 for (i = 0; i < 16; ++i)
441 ; // expected-error {{expected 4 for loops after '#pragma omp distribute simd', but found only 1}}
442 #pragma omp target
443 #pragma omp teams
444 // expected-error@+2 {{expected ')'}}
445 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
446 #pragma omp distribute simd collapse(4, , 4)
447 for (i = 0; i < 16; ++i)
448 ; // expected-error {{expected 4 for loops after '#pragma omp distribute simd', but found only 1}}
449 #pragma omp target
450 #pragma omp teams
451 #pragma omp distribute simd collapse(4)
452 for (int i1 = 0; i1 < 16; ++i1)
453 for (int i2 = 0; i2 < 16; ++i2)
454 for (int i3 = 0; i3 < 16; ++i3)
455 for (int i4 = 0; i4 < 16; ++i4)
456 foo();
457 #pragma omp target
458 #pragma omp teams
459 // expected-error@+2 {{expected ')'}}
460 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
461 #pragma omp distribute simd collapse(4, 8)
462 for (i = 0; i < 16; ++i)
463 ; // expected-error {{expected 4 for loops after '#pragma omp distribute simd', but found only 1}}
464 #pragma omp target
465 #pragma omp teams
466 // expected-error@+1 {{integer constant expression}}
467 #pragma omp distribute simd collapse(2.5)
468 for (i = 0; i < 16; ++i)
470 #pragma omp target
471 #pragma omp teams
472 // expected-error@+1 {{integer constant expression}}
473 #pragma omp distribute simd collapse(foo())
474 for (i = 0; i < 16; ++i)
476 #pragma omp target
477 #pragma omp teams
478 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
479 #pragma omp distribute simd collapse(-5)
480 for (i = 0; i < 16; ++i)
482 #pragma omp target
483 #pragma omp teams
484 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
485 #pragma omp distribute simd collapse(0)
486 for (i = 0; i < 16; ++i)
488 #pragma omp target
489 #pragma omp teams
490 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
491 #pragma omp distribute simd collapse(5 - 5)
492 for (i = 0; i < 16; ++i)
494 // expected-note@+3 2 {{defined as reduction}}
495 #pragma omp target
496 #pragma omp teams
497 #pragma omp distribute simd collapse(2) reduction(+ : i)
498 for (i = 0; i < 16; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp distribute simd' directive may not be reduction, predetermined as lastprivate}}
499 // expected-note@+1 {{variable with automatic storage duration is predetermined as private; perhaps you forget to enclose 'omp for' directive into a parallel or another task region?}}
500 for (int j = 0; j < 16; ++j)
501 // expected-error@+2 2 {{reduction variable must be shared}}
502 // expected-error@+1 {{OpenMP constructs may not be nested inside a simd region}}
503 #pragma omp for reduction(+ : i, j)
504 for (int k = 0; k < 16; ++k)
505 i += j;
507 #pragma omp target
508 #pragma omp teams
509 for (i = 0; i < 16; ++i)
510 for (int j = 0; j < 16; ++j)
511 #pragma omp distribute simd reduction(+ : i, j)
512 for (int k = 0; k < 16; ++k)
513 i += j;
516 void test_linear(void) {
517 int i;
518 #pragma omp target
519 #pragma omp teams
520 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
521 #pragma omp distribute simd linear(
522 for (i = 0; i < 16; ++i)
524 #pragma omp target
525 #pragma omp teams
526 // expected-error@+2 {{expected expression}}
527 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
528 #pragma omp distribute simd linear(,
529 for (i = 0; i < 16; ++i)
531 #pragma omp target
532 #pragma omp teams
533 // expected-error@+2 {{expected expression}}
534 // expected-error@+1 {{expected expression}}
535 #pragma omp distribute simd linear(, )
536 for (i = 0; i < 16; ++i)
538 #pragma omp target
539 #pragma omp teams
540 // expected-error@+1 {{expected expression}}
541 #pragma omp distribute simd linear()
542 for (i = 0; i < 16; ++i)
544 #pragma omp target
545 #pragma omp teams
546 // expected-error@+1 {{expected expression}}
547 #pragma omp distribute simd linear(int)
548 for (i = 0; i < 16; ++i)
550 #pragma omp target
551 #pragma omp teams
552 // expected-error@+1 {{expected variable name}}
553 #pragma omp distribute simd linear(0)
554 for (i = 0; i < 16; ++i)
556 #pragma omp target
557 #pragma omp teams
558 // expected-error@+1 {{use of undeclared identifier 'x'}}
559 #pragma omp distribute simd linear(x)
560 for (i = 0; i < 16; ++i)
562 #pragma omp target
563 #pragma omp teams
564 // expected-error@+2 {{use of undeclared identifier 'x'}}
565 // expected-error@+1 {{use of undeclared identifier 'y'}}
566 #pragma omp distribute simd linear(x, y)
567 for (i = 0; i < 16; ++i)
569 #pragma omp target
570 #pragma omp teams
571 // expected-error@+3 {{use of undeclared identifier 'x'}}
572 // expected-error@+2 {{use of undeclared identifier 'y'}}
573 // expected-error@+1 {{use of undeclared identifier 'z'}}
574 #pragma omp distribute simd linear(x, y, z)
575 for (i = 0; i < 16; ++i)
579 void test_aligned(void) {
580 int i;
581 #pragma omp target
582 #pragma omp teams
583 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
584 #pragma omp distribute simd aligned(
585 for (i = 0; i < 16; ++i)
587 #pragma omp target
588 #pragma omp teams
589 // expected-error@+2 {{expected expression}}
590 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
591 #pragma omp distribute simd aligned(,
592 for (i = 0; i < 16; ++i)
594 #pragma omp target
595 #pragma omp teams
596 // expected-error@+2 {{expected expression}}
597 // expected-error@+1 {{expected expression}}
598 #pragma omp distribute simd aligned(, )
599 for (i = 0; i < 16; ++i)
601 #pragma omp target
602 #pragma omp teams
603 // expected-error@+1 {{expected expression}}
604 #pragma omp distribute simd aligned()
605 for (i = 0; i < 16; ++i)
607 #pragma omp target
608 #pragma omp teams
609 // expected-error@+1 {{expected expression}}
610 #pragma omp distribute simd aligned(int)
611 for (i = 0; i < 16; ++i)
613 #pragma omp target
614 #pragma omp teams
615 // expected-error@+1 {{expected variable name}}
616 #pragma omp distribute simd aligned(0)
617 for (i = 0; i < 16; ++i)
619 #pragma omp target
620 #pragma omp teams
621 // expected-error@+1 {{use of undeclared identifier 'x'}}
622 #pragma omp distribute simd aligned(x)
623 for (i = 0; i < 16; ++i)
625 #pragma omp target
626 #pragma omp teams
627 // expected-error@+2 {{use of undeclared identifier 'x'}}
628 // expected-error@+1 {{use of undeclared identifier 'y'}}
629 #pragma omp distribute simd aligned(x, y)
630 for (i = 0; i < 16; ++i)
632 #pragma omp target
633 #pragma omp teams
634 // expected-error@+3 {{use of undeclared identifier 'x'}}
635 // expected-error@+2 {{use of undeclared identifier 'y'}}
636 // expected-error@+1 {{use of undeclared identifier 'z'}}
637 #pragma omp distribute simd aligned(x, y, z)
638 for (i = 0; i < 16; ++i)
641 int *x, y, z[25]; // expected-note 4 {{'y' defined here}}
642 #pragma omp target
643 #pragma omp teams
644 #pragma omp distribute simd aligned(x)
645 for (i = 0; i < 16; ++i)
647 #pragma omp target
648 #pragma omp teams
649 #pragma omp distribute simd aligned(z)
650 for (i = 0; i < 16; ++i)
652 #pragma omp target
653 #pragma omp teams
654 // expected-error@+1 {{expected expression}}
655 #pragma omp distribute simd aligned(x :)
656 for (i = 0; i < 16; ++i)
658 #pragma omp target
659 #pragma omp teams
660 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
661 #pragma omp distribute simd aligned(x :, )
662 for (i = 0; i < 16; ++i)
664 #pragma omp target
665 #pragma omp teams
666 #pragma omp distribute simd aligned(x : 1)
667 for (i = 0; i < 16; ++i)
669 #pragma omp target
670 #pragma omp teams
671 #pragma omp distribute simd aligned(x : 2 * 2)
672 for (i = 0; i < 16; ++i)
674 #pragma omp target
675 #pragma omp teams
676 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
677 #pragma omp distribute simd aligned(x : 1, y)
678 for (i = 0; i < 16; ++i)
680 #pragma omp target
681 #pragma omp teams
682 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
683 #pragma omp distribute simd aligned(x : 1, y, z : 1)
684 for (i = 0; i < 16; ++i)
687 #pragma omp target
688 #pragma omp teams
689 // expected-error@+1 {{argument of aligned clause should be array or pointer, not 'int'}}
690 #pragma omp distribute simd aligned(x, y)
691 for (i = 0; i < 16; ++i)
693 #pragma omp target
694 #pragma omp teams
695 // expected-error@+1 {{argument of aligned clause should be array or pointer, not 'int'}}
696 #pragma omp distribute simd aligned(x, y, z)
697 for (i = 0; i < 16; ++i)
700 #pragma omp target
701 #pragma omp teams
702 // expected-note@+2 {{defined as aligned}}
703 // expected-error@+1 {{a variable cannot appear in more than one aligned clause}}
704 #pragma omp distribute simd aligned(x) aligned(z, x)
705 for (i = 0; i < 16; ++i)
708 #pragma omp target
709 #pragma omp teams
710 // expected-note@+3 {{defined as aligned}}
711 // expected-error@+2 {{a variable cannot appear in more than one aligned clause}}
712 // expected-error@+1 2 {{argument of aligned clause should be array or pointer, not 'int'}}
713 #pragma omp distribute simd aligned(x, y, z) aligned(y, z)
714 for (i = 0; i < 16; ++i)
718 void test_private(void) {
719 int i;
720 #pragma omp target
721 #pragma omp teams
722 // expected-error@+2 {{expected expression}}
723 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
724 #pragma omp distribute simd private(
725 for (i = 0; i < 16; ++i)
727 #pragma omp target
728 #pragma omp teams
729 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
730 // expected-error@+1 2 {{expected expression}}
731 #pragma omp distribute simd private(,
732 for (i = 0; i < 16; ++i)
734 #pragma omp target
735 #pragma omp teams
736 // expected-error@+1 2 {{expected expression}}
737 #pragma omp distribute simd private(, )
738 for (i = 0; i < 16; ++i)
740 #pragma omp target
741 #pragma omp teams
742 // expected-error@+1 {{expected expression}}
743 #pragma omp distribute simd private()
744 for (i = 0; i < 16; ++i)
746 #pragma omp target
747 #pragma omp teams
748 // expected-error@+1 {{expected expression}}
749 #pragma omp distribute simd private(int)
750 for (i = 0; i < 16; ++i)
752 #pragma omp target
753 #pragma omp teams
754 // expected-error@+1 {{expected variable name}}
755 #pragma omp distribute simd private(0)
756 for (i = 0; i < 16; ++i)
759 int x, y, z;
760 #pragma omp target
761 #pragma omp teams
762 #pragma omp distribute simd private(x)
763 for (i = 0; i < 16; ++i)
765 #pragma omp target
766 #pragma omp teams
767 #pragma omp distribute simd private(x, y)
768 for (i = 0; i < 16; ++i)
770 #pragma omp target
771 #pragma omp teams
772 #pragma omp distribute simd private(x, y, z)
773 for (i = 0; i < 16; ++i) {
774 x = y * i + z;
778 void test_firstprivate(void) {
779 int i;
780 #pragma omp target
781 #pragma omp teams
782 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
783 // expected-error@+1 {{expected expression}}
784 #pragma omp distribute simd firstprivate(
785 for (i = 0; i < 16; ++i)
789 void test_lastprivate(void) {
790 int i;
791 #pragma omp target
792 #pragma omp teams
793 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
794 // expected-error@+1 {{expected expression}}
795 #pragma omp distribute simd lastprivate(
796 for (i = 0; i < 16; ++i)
799 #pragma omp target
800 #pragma omp teams
801 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
802 // expected-error@+1 2 {{expected expression}}
803 #pragma omp distribute simd lastprivate(,
804 for (i = 0; i < 16; ++i)
806 #pragma omp target
807 #pragma omp teams
808 // expected-error@+1 2 {{expected expression}}
809 #pragma omp distribute simd lastprivate(, )
810 for (i = 0; i < 16; ++i)
812 #pragma omp target
813 #pragma omp teams
814 // expected-error@+1 {{expected expression}}
815 #pragma omp distribute simd lastprivate()
816 for (i = 0; i < 16; ++i)
818 #pragma omp target
819 #pragma omp teams
820 // expected-error@+1 {{expected expression}}
821 #pragma omp distribute simd lastprivate(int)
822 for (i = 0; i < 16; ++i)
824 #pragma omp target
825 #pragma omp teams
826 // expected-error@+1 {{expected variable name}}
827 #pragma omp distribute simd lastprivate(0)
828 for (i = 0; i < 16; ++i)
831 int x, y, z;
832 #pragma omp target
833 #pragma omp teams
834 #pragma omp distribute simd lastprivate(x)
835 for (i = 0; i < 16; ++i)
837 #pragma omp target
838 #pragma omp teams
839 #pragma omp distribute simd lastprivate(x, y)
840 for (i = 0; i < 16; ++i)
842 #pragma omp target
843 #pragma omp teams
844 #pragma omp distribute simd lastprivate(x, y, z)
845 for (i = 0; i < 16; ++i)
849 void test_reduction(void) {
850 int i, x, y;
851 #pragma omp target
852 #pragma omp teams
853 // expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}}
854 // expected-error@+2 {{expected identifier}}
855 // expected-warning@+1 {{missing ':' after reduction identifier - ignoring}}
856 #pragma omp distribute simd reduction(
857 for (i = 0; i < 16; ++i)
859 #pragma omp target
860 #pragma omp teams
861 // expected-error@+2 {{expected identifier}}
862 // expected-warning@+1 {{missing ':' after reduction identifier - ignoring}}
863 #pragma omp distribute simd reduction()
864 for (i = 0; i < 16; ++i)
866 #pragma omp target
867 #pragma omp teams
868 // expected-error@+2 {{expected expression}}
869 // expected-warning@+1 {{missing ':' after reduction identifier - ignoring}}
870 #pragma omp distribute simd reduction(x)
871 for (i = 0; i < 16; ++i)
873 #pragma omp target
874 #pragma omp teams
875 // expected-error@+1 {{expected identifier}}
876 #pragma omp distribute simd reduction( : x)
877 for (i = 0; i < 16; ++i)
879 #pragma omp target
880 #pragma omp teams
881 // expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}}
882 // expected-error@+2 {{expected identifier}}
883 // expected-warning@+1 {{missing ':' after reduction identifier - ignoring}}
884 #pragma omp distribute simd reduction(,
885 for (i = 0; i < 16; ++i)
887 #pragma omp target
888 #pragma omp teams
889 // expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}}
890 // expected-error@+2 {{expected expression}}
891 // expected-warning@+1 {{missing ':' after reduction identifier - ignoring}}
892 #pragma omp distribute simd reduction(+
893 for (i = 0; i < 16; ++i)
896 #pragma omp target
897 #pragma omp teams
898 // expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}}
900 // expected-error@+1 {{expected expression}}
901 #pragma omp distribute simd reduction(+:
902 for (i = 0; i < 16; ++i)
904 #pragma omp target
905 #pragma omp teams
906 // expected-error@+1 {{expected expression}}
907 #pragma omp distribute simd reduction(+ :)
908 for (i = 0; i < 16; ++i)
910 #pragma omp target
911 #pragma omp teams
912 // expected-error@+1 {{expected expression}}
913 #pragma omp distribute simd reduction(+ :, y)
914 for (i = 0; i < 16; ++i)
916 #pragma omp target
917 #pragma omp teams
918 // expected-error@+1 {{expected expression}}
919 #pragma omp distribute simd reduction(+ : x, + : y)
920 for (i = 0; i < 16; ++i)
922 #pragma omp target
923 #pragma omp teams
924 // expected-error@+1 {{expected identifier}}
925 #pragma omp distribute simd reduction(% : x)
926 for (i = 0; i < 16; ++i)
929 #pragma omp target
930 #pragma omp teams
931 #pragma omp distribute simd reduction(+ : x)
932 for (i = 0; i < 16; ++i)
934 #pragma omp target
935 #pragma omp teams
936 #pragma omp distribute simd reduction(* : x)
937 for (i = 0; i < 16; ++i)
939 #pragma omp target
940 #pragma omp teams
941 #pragma omp distribute simd reduction(- : x)
942 for (i = 0; i < 16; ++i)
944 #pragma omp target
945 #pragma omp teams
946 #pragma omp distribute simd reduction(& : x)
947 for (i = 0; i < 16; ++i)
949 #pragma omp target
950 #pragma omp teams
951 #pragma omp distribute simd reduction(| : x)
952 for (i = 0; i < 16; ++i)
954 #pragma omp target
955 #pragma omp teams
956 #pragma omp distribute simd reduction(^ : x)
957 for (i = 0; i < 16; ++i)
959 #pragma omp target
960 #pragma omp teams
961 #pragma omp distribute simd reduction(&& : x)
962 for (i = 0; i < 16; ++i)
964 #pragma omp target
965 #pragma omp teams
966 #pragma omp distribute simd reduction(|| : x)
967 for (i = 0; i < 16; ++i)
969 #pragma omp target
970 #pragma omp teams
971 #pragma omp distribute simd reduction(max : x)
972 for (i = 0; i < 16; ++i)
974 #pragma omp target
975 #pragma omp teams
976 #pragma omp distribute simd reduction(min : x)
977 for (i = 0; i < 16; ++i)
979 struct X {
980 int x;
982 struct X X;
983 #pragma omp target
984 #pragma omp teams
985 // expected-error@+1 {{expected variable name}}
986 #pragma omp distribute simd reduction(+ : X.x)
987 for (i = 0; i < 16; ++i)
989 #pragma omp target
990 #pragma omp teams
991 // expected-error@+1 {{expected variable name}}
992 #pragma omp distribute simd reduction(+ : x + x)
993 for (i = 0; i < 16; ++i)
997 void test_loop_messages(void) {
998 float a[100], b[100], c[100];
999 #pragma omp target
1000 #pragma omp teams
1001 // expected-error@+2 {{variable must be of integer or pointer type}}
1002 #pragma omp distribute simd
1003 for (float fi = 0; fi < 10.0; fi++) {
1004 c[(int)fi] = a[(int)fi] + b[(int)fi];
1006 #pragma omp target
1007 #pragma omp teams
1008 // expected-error@+2 {{variable must be of integer or pointer type}}
1009 #pragma omp distribute simd
1010 for (double fi = 0; fi < 10.0; fi++) {
1011 c[(int)fi] = a[(int)fi] + b[(int)fi];
1015 void linear_modifiers(int argc) {
1016 int k;
1017 #pragma omp target
1018 #pragma omp teams
1019 #pragma omp distribute simd linear(k)
1020 for (k = 0; k < argc; ++k) ++k;
1021 #pragma omp target
1022 #pragma omp teams
1023 #pragma omp distribute simd linear(val(k))
1024 for (k = 0; k < argc; ++k) ++k;
1025 #pragma omp target
1026 #pragma omp teams
1027 #pragma omp distribute simd linear(uval(k)) // expected-error {{expected 'val' modifier}}
1028 for (k = 0; k < argc; ++k) ++k;
1029 #pragma omp target
1030 #pragma omp teams
1031 #pragma omp distribute simd linear(ref(k)) // expected-error {{expected 'val' modifier}}
1032 for (k = 0; k < argc; ++k) ++k;
1033 #pragma omp target
1034 #pragma omp teams
1035 #pragma omp distribute simd linear(foo(k)) // expected-error {{expected 'val' modifier}}
1036 for (k = 0; k < argc; ++k) ++k;
1039 void test_nontemporal(void) {
1040 int i;
1041 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
1042 #pragma omp distribute simd nontemporal(
1043 for (i = 0; i < 16; ++i)
1045 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} expected-error@+1 2 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
1046 #pragma omp distribute simd nontemporal(,
1047 for (i = 0; i < 16; ++i)
1049 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} expected-error@+1 2 {{expected expression}}
1050 #pragma omp distribute simd nontemporal(, )
1051 for (i = 0; i < 16; ++i)
1053 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} expected-error@+1 {{expected expression}}
1054 #pragma omp distribute simd nontemporal()
1055 for (i = 0; i < 16; ++i)
1057 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} expected-error@+1 {{expected expression}}
1058 #pragma omp distribute simd nontemporal(int)
1059 for (i = 0; i < 16; ++i)
1061 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} omp50-error@+1 {{expected variable name}} omp51-error@+1 {{expected variable name}}
1062 #pragma omp distribute simd nontemporal(0)
1063 for (i = 0; i < 16; ++i)
1065 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} expected-error@+1 {{use of undeclared identifier 'x'}}
1066 #pragma omp distribute simd nontemporal(x)
1067 for (i = 0; i < 16; ++i)
1069 // expected-error@+2 {{use of undeclared identifier 'x'}}
1070 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} expected-error@+1 {{use of undeclared identifier 'y'}}
1071 #pragma omp distribute simd nontemporal(x, y)
1072 for (i = 0; i < 16; ++i)
1074 // expected-error@+3 {{use of undeclared identifier 'x'}}
1075 // expected-error@+2 {{use of undeclared identifier 'y'}}
1076 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} expected-error@+1 {{use of undeclared identifier 'z'}}
1077 #pragma omp distribute simd nontemporal(x, y, z)
1078 for (i = 0; i < 16; ++i)
1081 int x, y;
1082 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} expected-error@+1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
1083 #pragma omp distribute simd nontemporal(x :)
1084 for (i = 0; i < 16; ++i)
1086 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} expected-error@+1 {{expected ',' or ')' in 'nontemporal' clause}}
1087 #pragma omp distribute simd nontemporal(x :, )
1088 for (i = 0; i < 16; ++i)
1091 // omp51-note@+3 {{defined as nontemporal}}
1092 // omp50-note@+2 {{defined as nontemporal}}
1093 // omp45-error@+1 2 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute 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}}
1094 #pragma omp distribute simd nontemporal(x) nontemporal(x)
1095 for (i = 0; i < 16; ++i)
1098 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}}
1099 #pragma omp distribute simd private(x) nontemporal(x)
1100 for (i = 0; i < 16; ++i)
1103 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}}
1104 #pragma omp distribute simd nontemporal(x) private(x)
1105 for (i = 0; i < 16; ++i)
1108 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} expected-note@+1 {{to match this '('}} expected-error@+1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error@+1 {{expected ')'}}
1109 #pragma omp distribute simd nontemporal(x, y : 0)
1110 for (i = 0; i < 16; ++i)
1113 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}}
1114 #pragma omp distribute simd nontemporal(x) lastprivate(x)
1115 for (i = 0; i < 16; ++i)
1118 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}}
1119 #pragma omp distribute simd lastprivate(x) nontemporal(x)
1120 for (i = 0; i < 16; ++i)
1122 #pragma omp distribute simd order // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute simd'}} expected-error {{expected '(' after 'order'}}
1123 for (int i = 0; i < 10; ++i)
1125 #pragma omp distribute simd order( // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute 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'}}
1126 for (int i = 0; i < 10; ++i)
1128 #pragma omp distribute simd order(none // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute 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'}}
1129 for (int i = 0; i < 10; ++i)
1131 #pragma omp distribute simd order(concurrent // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute simd'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
1132 for (int i = 0; i < 10; ++i)
1134 #pragma omp distribute simd order(concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute simd'}}
1135 for (int i = 0; i < 10; ++i)
1137 #pragma omp distribute simd order(unconstrained:) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute simd'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}} omp51-error {{expected 'concurrent' in OpenMP clause 'order'}}
1138 for (int i = 0; i < 10; ++i)
1140 #pragma omp distribute simd order(reproducible:concurrent // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute simd'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
1141 for (int i = 0; i < 10; ++i)
1143 #pragma omp distribute simd order(reproducible:concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute simd'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
1144 for (int i = 0; i < 10; ++i)
1146 #pragma omp distribute simd order(unconstrained:concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute simd'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
1147 for (int i = 0; i < 10; ++i)
1149 #pragma omp distribute simd order(concurrent) order(concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute simd'}} omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute simd'}} omp51-error {{directive '#pragma omp distribute simd' cannot contain more than one 'order' clause}}
1150 for (int i = 0; i < 10; ++i)