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
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) {
29 #pragma omp distribute simd
30 for (i
= 0; i
< 16; ++i
)
35 // expected-error@+2 {{statement after '#pragma omp distribute simd' must be a for loop}}
36 #pragma omp distribute simd
40 void test_branch_protected_scope(void) {
49 #pragma omp distribute simd
50 for (i
= 0; i
< 16; ++i
) {
52 goto L1
; // expected-error {{use of undeclared label 'L1'}}
54 return; // expected-error {{cannot return from OpenMP region}}
64 goto L2
; // expected-error {{use of undeclared label 'L2'}}
69 void test_invalid_clause(void) {
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) {
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
)
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
)
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) {
109 // expected-error@+1 {{expected '('}}
110 #pragma omp distribute simd safelen
111 for (i
= 0; i
< 16; ++i
)
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
)
121 // expected-error@+1 {{expected expression}}
122 #pragma omp distribute simd safelen()
123 for (i
= 0; i
< 16; ++i
)
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
)
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
)
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
)
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
)
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
)
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
)
167 // xxpected-error@+1 {{expected expression}}
168 #pragma omp distribute simd safelen(4)
169 for (i
= 0; i
< 16; ++i
)
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
)
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
)
187 #pragma omp distribute simd safelen(4)
188 for (i
= 0; i
< 16; ++i
)
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
)
199 // expected-error@+1 {{integer constant expression}}
200 #pragma omp distribute simd safelen(2.5)
201 for (i
= 0; i
< 16; ++i
)
205 // expected-error@+1 {{integer constant expression}}
206 #pragma omp distribute simd safelen(foo())
207 for (i
= 0; i
< 16; ++i
)
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
)
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
)
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) {
233 // expected-error@+1 {{expected '('}}
234 #pragma omp distribute simd simdlen
235 for (i
= 0; i
< 16; ++i
)
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
)
245 // expected-error@+1 {{expected expression}}
246 #pragma omp distribute simd simdlen()
247 for (i
= 0; i
< 16; ++i
)
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
)
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
)
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
)
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
)
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
)
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
)
291 #pragma omp distribute simd simdlen(4)
292 for (i
= 0; i
< 16; ++i
)
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
)
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
)
310 #pragma omp distribute simd simdlen(4)
311 for (i
= 0; i
< 16; ++i
)
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
)
322 // expected-error@+1 {{integer constant expression}}
323 #pragma omp distribute simd simdlen(2.5)
324 for (i
= 0; i
< 16; ++i
)
328 // expected-error@+1 {{integer constant expression}}
329 #pragma omp distribute simd simdlen(foo())
330 for (i
= 0; i
< 16; ++i
)
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
)
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
)
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) {
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
)
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) {
373 // expected-error@+1 {{expected '('}}
374 #pragma omp distribute simd collapse
375 for (i
= 0; i
< 16; ++i
)
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
)
385 // expected-error@+1 {{expected expression}}
386 #pragma omp distribute simd collapse()
387 for (i
= 0; i
< 16; ++i
)
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
)
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
)
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
)
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}}
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}}
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}}
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}}
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}}
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}}
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
)
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}}
466 // expected-error@+1 {{integer constant expression}}
467 #pragma omp distribute simd collapse(2.5)
468 for (i
= 0; i
< 16; ++i
)
472 // expected-error@+1 {{integer constant expression}}
473 #pragma omp distribute simd collapse(foo())
474 for (i
= 0; i
< 16; ++i
)
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
)
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
)
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}}
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
)
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
)
516 void test_linear(void) {
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
)
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
)
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
)
540 // expected-error@+1 {{expected expression}}
541 #pragma omp distribute simd linear()
542 for (i
= 0; i
< 16; ++i
)
546 // expected-error@+1 {{expected expression}}
547 #pragma omp distribute simd linear(int)
548 for (i
= 0; i
< 16; ++i
)
552 // expected-error@+1 {{expected variable name}}
553 #pragma omp distribute simd linear(0)
554 for (i
= 0; i
< 16; ++i
)
558 // expected-error@+1 {{use of undeclared identifier 'x'}}
559 #pragma omp distribute simd linear(x)
560 for (i
= 0; i
< 16; ++i
)
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
)
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) {
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
)
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
)
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
)
603 // expected-error@+1 {{expected expression}}
604 #pragma omp distribute simd aligned()
605 for (i
= 0; i
< 16; ++i
)
609 // expected-error@+1 {{expected expression}}
610 #pragma omp distribute simd aligned(int)
611 for (i
= 0; i
< 16; ++i
)
615 // expected-error@+1 {{expected variable name}}
616 #pragma omp distribute simd aligned(0)
617 for (i
= 0; i
< 16; ++i
)
621 // expected-error@+1 {{use of undeclared identifier 'x'}}
622 #pragma omp distribute simd aligned(x)
623 for (i
= 0; i
< 16; ++i
)
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
)
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}}
644 #pragma omp distribute simd aligned(x)
645 for (i
= 0; i
< 16; ++i
)
649 #pragma omp distribute simd aligned(z)
650 for (i
= 0; i
< 16; ++i
)
654 // expected-error@+1 {{expected expression}}
655 #pragma omp distribute simd aligned(x :)
656 for (i
= 0; i
< 16; ++i
)
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
)
666 #pragma omp distribute simd aligned(x : 1)
667 for (i
= 0; i
< 16; ++i
)
671 #pragma omp distribute simd aligned(x : 2 * 2)
672 for (i
= 0; i
< 16; ++i
)
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
)
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
)
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
)
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
)
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
)
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) {
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
)
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
)
736 // expected-error@+1 2 {{expected expression}}
737 #pragma omp distribute simd private(, )
738 for (i
= 0; i
< 16; ++i
)
742 // expected-error@+1 {{expected expression}}
743 #pragma omp distribute simd private()
744 for (i
= 0; i
< 16; ++i
)
748 // expected-error@+1 {{expected expression}}
749 #pragma omp distribute simd private(int)
750 for (i
= 0; i
< 16; ++i
)
754 // expected-error@+1 {{expected variable name}}
755 #pragma omp distribute simd private(0)
756 for (i
= 0; i
< 16; ++i
)
762 #pragma omp distribute simd private(x)
763 for (i
= 0; i
< 16; ++i
)
767 #pragma omp distribute simd private(x, y)
768 for (i
= 0; i
< 16; ++i
)
772 #pragma omp distribute simd private(x, y, z)
773 for (i
= 0; i
< 16; ++i
) {
778 void test_firstprivate(void) {
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) {
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
)
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
)
808 // expected-error@+1 2 {{expected expression}}
809 #pragma omp distribute simd lastprivate(, )
810 for (i
= 0; i
< 16; ++i
)
814 // expected-error@+1 {{expected expression}}
815 #pragma omp distribute simd lastprivate()
816 for (i
= 0; i
< 16; ++i
)
820 // expected-error@+1 {{expected expression}}
821 #pragma omp distribute simd lastprivate(int)
822 for (i
= 0; i
< 16; ++i
)
826 // expected-error@+1 {{expected variable name}}
827 #pragma omp distribute simd lastprivate(0)
828 for (i
= 0; i
< 16; ++i
)
834 #pragma omp distribute simd lastprivate(x)
835 for (i
= 0; i
< 16; ++i
)
839 #pragma omp distribute simd lastprivate(x, y)
840 for (i
= 0; i
< 16; ++i
)
844 #pragma omp distribute simd lastprivate(x, y, z)
845 for (i
= 0; i
< 16; ++i
)
849 void test_reduction(void) {
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
)
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
)
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
)
875 // expected-error@+1 {{expected identifier}}
876 #pragma omp distribute simd reduction( : x)
877 for (i
= 0; i
< 16; ++i
)
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
)
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
)
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
)
906 // expected-error@+1 {{expected expression}}
907 #pragma omp distribute simd reduction(+ :)
908 for (i
= 0; i
< 16; ++i
)
912 // expected-error@+1 {{expected expression}}
913 #pragma omp distribute simd reduction(+ :, y)
914 for (i
= 0; i
< 16; ++i
)
918 // expected-error@+1 {{expected expression}}
919 #pragma omp distribute simd reduction(+ : x, + : y)
920 for (i
= 0; i
< 16; ++i
)
924 // expected-error@+1 {{expected identifier}}
925 #pragma omp distribute simd reduction(% : x)
926 for (i
= 0; i
< 16; ++i
)
931 #pragma omp distribute simd reduction(+ : x)
932 for (i
= 0; i
< 16; ++i
)
936 #pragma omp distribute simd reduction(* : x)
937 for (i
= 0; i
< 16; ++i
)
941 #pragma omp distribute simd reduction(- : x)
942 for (i
= 0; i
< 16; ++i
)
946 #pragma omp distribute simd reduction(& : x)
947 for (i
= 0; i
< 16; ++i
)
951 #pragma omp distribute simd reduction(| : x)
952 for (i
= 0; i
< 16; ++i
)
956 #pragma omp distribute simd reduction(^ : x)
957 for (i
= 0; i
< 16; ++i
)
961 #pragma omp distribute simd reduction(&& : x)
962 for (i
= 0; i
< 16; ++i
)
966 #pragma omp distribute simd reduction(|| : x)
967 for (i
= 0; i
< 16; ++i
)
971 #pragma omp distribute simd reduction(max : x)
972 for (i
= 0; i
< 16; ++i
)
976 #pragma omp distribute simd reduction(min : x)
977 for (i
= 0; i
< 16; ++i
)
985 // expected-error@+1 {{expected variable name}}
986 #pragma omp distribute simd reduction(+ : X.x)
987 for (i
= 0; i
< 16; ++i
)
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];
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
];
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
) {
1019 #pragma omp distribute simd linear(k)
1020 for (k
= 0; k
< argc
; ++k
) ++k
;
1023 #pragma omp distribute simd linear(val(k))
1024 for (k
= 0; k
< argc
; ++k
) ++k
;
1027 #pragma omp distribute simd linear(uval(k)) // expected-error {{expected 'val' modifier}}
1028 for (k
= 0; k
< argc
; ++k
) ++k
;
1031 #pragma omp distribute simd linear(ref(k)) // expected-error {{expected 'val' modifier}}
1032 for (k
= 0; k
< argc
; ++k
) ++k
;
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) {
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
)
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
)