[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / parallel_for_simd_misc_messages.c
blob4cb37ba27107b09aedd73052e6e9124ac017b73e
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 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp parallel for simd'}}
10 #pragma omp parallel for simd
12 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp parallel for simd'}}
13 #pragma omp parallel for simd foo
15 void test_no_clause(void) {
16 int i;
17 #pragma omp parallel for simd
18 for (i = 0; i < 16; ++i)
21 // expected-error@+2 {{statement after '#pragma omp parallel for simd' must be a for loop}}
22 #pragma omp parallel for simd
23 ++i;
26 void test_branch_protected_scope(void) {
27 int i = 0;
28 L1:
29 ++i;
31 int x[24];
33 #pragma omp parallel
34 #pragma omp parallel for simd
35 for (i = 0; i < 16; ++i) {
36 if (i == 5)
37 goto L1; // expected-error {{use of undeclared label 'L1'}}
38 else if (i == 6)
39 return; // expected-error {{cannot return from OpenMP region}}
40 else if (i == 7)
41 goto L2;
42 else if (i == 8) {
43 L2:
44 x[i]++;
48 if (x[0] == 0)
49 goto L2; // expected-error {{use of undeclared label 'L2'}}
50 else if (x[1] == 1)
51 goto L1;
54 void test_invalid_clause(void) {
55 int i;
56 #pragma omp parallel
57 // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
58 #pragma omp parallel for simd foo bar
59 for (i = 0; i < 16; ++i)
63 void test_non_identifiers(void) {
64 int i, x;
66 #pragma omp parallel
67 // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
68 #pragma omp parallel for simd;
69 for (i = 0; i < 16; ++i)
71 #pragma omp parallel
72 // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
73 #pragma omp parallel for simd linear(x);
74 for (i = 0; i < 16; ++i)
77 #pragma omp parallel
78 // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
79 #pragma omp parallel for simd private(x);
80 for (i = 0; i < 16; ++i)
83 #pragma omp parallel
84 // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
85 #pragma omp parallel for simd, private(x);
86 for (i = 0; i < 16; ++i)
90 extern int foo(void);
91 void test_safelen(void) {
92 int i;
93 // expected-error@+1 {{expected '('}}
94 #pragma omp parallel for simd safelen
95 for (i = 0; i < 16; ++i)
97 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
98 #pragma omp parallel for simd safelen(
99 for (i = 0; i < 16; ++i)
101 // expected-error@+1 {{expected expression}}
102 #pragma omp parallel for simd safelen()
103 for (i = 0; i < 16; ++i)
105 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
106 #pragma omp parallel for simd safelen(,
107 for (i = 0; i < 16; ++i)
109 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
110 #pragma omp parallel for simd safelen(, )
111 for (i = 0; i < 16; ++i)
113 // expected-warning@+2 {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
114 // expected-error@+1 {{expected '('}}
115 #pragma omp parallel for simd safelen 4)
116 for (i = 0; i < 16; ++i)
118 // expected-error@+2 {{expected ')'}}
119 // expected-note@+1 {{to match this '('}}
120 #pragma omp parallel for simd safelen(4
121 for (i = 0; i < 16; ++i)
123 // expected-error@+2 {{expected ')'}}
124 // expected-note@+1 {{to match this '('}}
125 #pragma omp parallel for simd safelen(4,
126 for (i = 0; i < 16; ++i)
128 // expected-error@+2 {{expected ')'}}
129 // expected-note@+1 {{to match this '('}}
130 #pragma omp parallel for simd safelen(4, )
131 for (i = 0; i < 16; ++i)
133 #pragma omp parallel for simd safelen(4)
134 for (i = 0; i < 16; ++i)
136 // expected-error@+2 {{expected ')'}}
137 // expected-note@+1 {{to match this '('}}
138 #pragma omp parallel for simd safelen(4 4)
139 for (i = 0; i < 16; ++i)
141 // expected-error@+2 {{expected ')'}}
142 // expected-note@+1 {{to match this '('}}
143 #pragma omp parallel for simd safelen(4, , 4)
144 for (i = 0; i < 16; ++i)
146 #pragma omp parallel for simd safelen(4)
147 for (i = 0; i < 16; ++i)
149 // expected-error@+2 {{expected ')'}}
150 // expected-note@+1 {{to match this '('}}
151 #pragma omp parallel for simd safelen(4, 8)
152 for (i = 0; i < 16; ++i)
154 // expected-error@+1 {{integer constant expression}}
155 #pragma omp parallel for simd safelen(2.5)
156 for (i = 0; i < 16; ++i)
158 // expected-error@+1 {{integer constant expression}}
159 #pragma omp parallel for simd safelen(foo())
160 for (i = 0; i < 16; ++i)
162 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
163 #pragma omp parallel for simd safelen(-5)
164 for (i = 0; i < 16; ++i)
166 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
167 #pragma omp parallel for simd safelen(0)
168 for (i = 0; i < 16; ++i)
170 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
171 #pragma omp parallel for simd safelen(5 - 5)
172 for (i = 0; i < 16; ++i)
176 void test_simdlen(void) {
177 int i;
178 // expected-error@+1 {{expected '('}}
179 #pragma omp parallel for simd simdlen
180 for (i = 0; i < 16; ++i)
182 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
183 #pragma omp parallel for simd simdlen(
184 for (i = 0; i < 16; ++i)
186 // expected-error@+1 {{expected expression}}
187 #pragma omp parallel for simd simdlen()
188 for (i = 0; i < 16; ++i)
190 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
191 #pragma omp parallel for simd simdlen(,
192 for (i = 0; i < 16; ++i)
194 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
195 #pragma omp parallel for simd simdlen(, )
196 for (i = 0; i < 16; ++i)
198 // expected-warning@+2 {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
199 // expected-error@+1 {{expected '('}}
200 #pragma omp parallel for simd simdlen 4)
201 for (i = 0; i < 16; ++i)
203 // expected-error@+2 {{expected ')'}}
204 // expected-note@+1 {{to match this '('}}
205 #pragma omp parallel for simd simdlen(4
206 for (i = 0; i < 16; ++i)
208 // expected-error@+2 {{expected ')'}}
209 // expected-note@+1 {{to match this '('}}
210 #pragma omp parallel for simd simdlen(4,
211 for (i = 0; i < 16; ++i)
213 // expected-error@+2 {{expected ')'}}
214 // expected-note@+1 {{to match this '('}}
215 #pragma omp parallel for simd simdlen(4, )
216 for (i = 0; i < 16; ++i)
218 #pragma omp parallel for simd simdlen(4)
219 for (i = 0; i < 16; ++i)
221 // expected-error@+2 {{expected ')'}}
222 // expected-note@+1 {{to match this '('}}
223 #pragma omp parallel for simd simdlen(4 4)
224 for (i = 0; i < 16; ++i)
226 // expected-error@+2 {{expected ')'}}
227 // expected-note@+1 {{to match this '('}}
228 #pragma omp parallel for simd simdlen(4, , 4)
229 for (i = 0; i < 16; ++i)
231 #pragma omp parallel for simd simdlen(4)
232 for (i = 0; i < 16; ++i)
234 // expected-error@+2 {{expected ')'}}
235 // expected-note@+1 {{to match this '('}}
236 #pragma omp parallel for simd simdlen(4, 8)
237 for (i = 0; i < 16; ++i)
239 // expected-error@+1 {{integer constant expression}}
240 #pragma omp parallel for simd simdlen(2.5)
241 for (i = 0; i < 16; ++i)
243 // expected-error@+1 {{integer constant expression}}
244 #pragma omp parallel for simd simdlen(foo())
245 for (i = 0; i < 16; ++i)
247 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
248 #pragma omp parallel for simd simdlen(-5)
249 for (i = 0; i < 16; ++i)
251 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
252 #pragma omp parallel for simd simdlen(0)
253 for (i = 0; i < 16; ++i)
255 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
256 #pragma omp parallel for simd simdlen(5 - 5)
257 for (i = 0; i < 16; ++i)
261 void test_safelen_simdlen(void) {
262 int i;
263 // expected-error@+1 {{the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter}}
264 #pragma omp parallel for simd simdlen(6) safelen(5)
265 for (i = 0; i < 16; ++i)
267 // expected-error@+1 {{the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter}}
268 #pragma omp parallel for simd safelen(5) simdlen(6)
269 for (i = 0; i < 16; ++i)
273 void test_collapse(void) {
274 int i;
275 #pragma omp parallel
276 // expected-error@+1 {{expected '('}}
277 #pragma omp parallel for simd collapse
278 for (i = 0; i < 16; ++i)
280 #pragma omp parallel
281 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
282 #pragma omp parallel for simd collapse(
283 for (i = 0; i < 16; ++i)
285 #pragma omp parallel
286 // expected-error@+1 {{expected expression}}
287 #pragma omp parallel for simd collapse()
288 for (i = 0; i < 16; ++i)
290 #pragma omp parallel
291 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
292 #pragma omp parallel for simd collapse(,
293 for (i = 0; i < 16; ++i)
295 #pragma omp parallel
296 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
297 #pragma omp parallel for simd collapse(, )
298 for (i = 0; i < 16; ++i)
300 #pragma omp parallel
301 // expected-warning@+2 {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
302 // expected-error@+1 {{expected '('}}
303 #pragma omp parallel for simd collapse 4)
304 for (i = 0; i < 16; ++i)
306 #pragma omp parallel
307 // expected-error@+2 {{expected ')'}}
308 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
309 #pragma omp parallel for simd collapse(4
310 for (i = 0; i < 16; ++i)
311 ; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
312 #pragma omp parallel
313 // expected-error@+2 {{expected ')'}}
314 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
315 #pragma omp parallel for simd collapse(4,
316 for (i = 0; i < 16; ++i)
317 ; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
318 #pragma omp parallel
319 // expected-error@+2 {{expected ')'}}
320 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
321 #pragma omp parallel for simd collapse(4, )
322 for (i = 0; i < 16; ++i)
323 ; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
324 #pragma omp parallel
325 // expected-note@+1 {{as specified in 'collapse' clause}}
326 #pragma omp parallel for simd collapse(4)
327 for (i = 0; i < 16; ++i)
328 ; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
329 #pragma omp parallel
330 // expected-error@+2 {{expected ')'}}
331 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
332 #pragma omp parallel for simd collapse(4 4)
333 for (i = 0; i < 16; ++i)
334 ; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
335 #pragma omp parallel
336 // expected-error@+2 {{expected ')'}}
337 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
338 #pragma omp parallel for simd collapse(4, , 4)
339 for (i = 0; i < 16; ++i)
340 ; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
341 #pragma omp parallel
342 #pragma omp parallel for simd collapse(4)
343 for (int i1 = 0; i1 < 16; ++i1)
344 for (int i2 = 0; i2 < 16; ++i2)
345 for (int i3 = 0; i3 < 16; ++i3)
346 for (int i4 = 0; i4 < 16; ++i4)
347 foo();
348 #pragma omp parallel
349 // expected-error@+2 {{expected ')'}}
350 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
351 #pragma omp parallel for simd collapse(4, 8)
352 for (i = 0; i < 16; ++i)
353 ; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
354 #pragma omp parallel
355 // expected-error@+1 {{integer constant expression}}
356 #pragma omp parallel for simd collapse(2.5)
357 for (i = 0; i < 16; ++i)
359 #pragma omp parallel
360 // expected-error@+1 {{integer constant expression}}
361 #pragma omp parallel for simd collapse(foo())
362 for (i = 0; i < 16; ++i)
364 #pragma omp parallel
365 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
366 #pragma omp parallel for simd collapse(-5)
367 for (i = 0; i < 16; ++i)
369 #pragma omp parallel
370 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
371 #pragma omp parallel for simd collapse(0)
372 for (i = 0; i < 16; ++i)
374 #pragma omp parallel
375 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
376 #pragma omp parallel for simd collapse(5 - 5)
377 for (i = 0; i < 16; ++i)
379 #pragma omp parallel
380 #pragma omp parallel for simd collapse(2)
381 for (i = 0; i < 16; ++i)
382 for (int j = 0; j < 16; ++j)
383 // expected-error@+1 {{OpenMP constructs may not be nested inside a simd region}}
384 #pragma omp parallel for simd reduction(+ : i, j)
385 for (int k = 0; k < 16; ++k)
386 i += j;
389 void test_linear(void) {
390 int i;
391 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
392 #pragma omp parallel for simd linear(
393 for (i = 0; i < 16; ++i)
395 // expected-error@+2 {{expected expression}}
396 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
397 #pragma omp parallel for simd linear(,
398 for (i = 0; i < 16; ++i)
400 // expected-error@+2 {{expected expression}}
401 // expected-error@+1 {{expected expression}}
402 #pragma omp parallel for simd linear(, )
403 for (i = 0; i < 16; ++i)
405 // expected-error@+1 {{expected expression}}
406 #pragma omp parallel for simd linear()
407 for (i = 0; i < 16; ++i)
409 // expected-error@+1 {{expected expression}}
410 #pragma omp parallel for simd linear(int)
411 for (i = 0; i < 16; ++i)
413 // expected-error@+1 {{expected variable name}}
414 #pragma omp parallel for simd linear(0)
415 for (i = 0; i < 16; ++i)
417 // expected-error@+1 {{use of undeclared identifier 'x'}}
418 #pragma omp parallel for simd linear(x)
419 for (i = 0; i < 16; ++i)
421 // expected-error@+2 {{use of undeclared identifier 'x'}}
422 // expected-error@+1 {{use of undeclared identifier 'y'}}
423 #pragma omp parallel for simd linear(x, y)
424 for (i = 0; i < 16; ++i)
426 // expected-error@+3 {{use of undeclared identifier 'x'}}
427 // expected-error@+2 {{use of undeclared identifier 'y'}}
428 // expected-error@+1 {{use of undeclared identifier 'z'}}
429 #pragma omp parallel for simd linear(x, y, z)
430 for (i = 0; i < 16; ++i)
433 int x, y;
434 // expected-error@+1 {{expected expression}}
435 #pragma omp parallel for simd linear(x :)
436 for (i = 0; i < 16; ++i)
438 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
439 #pragma omp parallel for simd linear(x :, )
440 for (i = 0; i < 16; ++i)
442 #pragma omp parallel for simd linear(x : 1)
443 for (i = 0; i < 16; ++i)
445 #pragma omp parallel for simd linear(x : 2 * 2)
446 for (i = 0; i < 16; ++i)
448 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
449 #pragma omp parallel for simd linear(x : 1, y)
450 for (i = 0; i < 16; ++i)
452 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
453 #pragma omp parallel for simd linear(x : 1, y, z : 1)
454 for (i = 0; i < 16; ++i)
457 // expected-note@+2 {{defined as linear}}
458 // expected-error@+1 {{linear variable cannot be linear}}
459 #pragma omp parallel for simd linear(x) linear(x)
460 for (i = 0; i < 16; ++i)
463 // expected-note@+2 {{defined as private}}
464 // expected-error@+1 {{private variable cannot be linear}}
465 #pragma omp parallel for simd private(x) linear(x)
466 for (i = 0; i < 16; ++i)
469 // expected-note@+2 {{defined as linear}}
470 // expected-error@+1 {{linear variable cannot be private}}
471 #pragma omp parallel for simd linear(x) private(x)
472 for (i = 0; i < 16; ++i)
475 // expected-warning@+1 {{zero linear step (x and other variables in clause should probably be const)}}
476 #pragma omp parallel for simd linear(x, y : 0)
477 for (i = 0; i < 16; ++i)
480 // expected-note@+2 {{defined as linear}}
481 // expected-error@+1 {{linear variable cannot be lastprivate}}
482 #pragma omp parallel for simd linear(x) lastprivate(x)
483 for (i = 0; i < 16; ++i)
486 #pragma omp parallel
487 // expected-note@+2 {{defined as lastprivate}}
488 // expected-error@+1 {{lastprivate variable cannot be linear}}
489 #pragma omp parallel for simd lastprivate(x) linear(x)
490 for (i = 0; i < 16; ++i)
494 void test_aligned(void) {
495 int i;
496 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
497 #pragma omp parallel for simd aligned(
498 for (i = 0; i < 16; ++i)
500 // expected-error@+2 {{expected expression}}
501 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
502 #pragma omp parallel for simd aligned(,
503 for (i = 0; i < 16; ++i)
505 // expected-error@+2 {{expected expression}}
506 // expected-error@+1 {{expected expression}}
507 #pragma omp parallel for simd aligned(, )
508 for (i = 0; i < 16; ++i)
510 // expected-error@+1 {{expected expression}}
511 #pragma omp parallel for simd aligned()
512 for (i = 0; i < 16; ++i)
514 // expected-error@+1 {{expected expression}}
515 #pragma omp parallel for simd aligned(int)
516 for (i = 0; i < 16; ++i)
518 // expected-error@+1 {{expected variable name}}
519 #pragma omp parallel for simd aligned(0)
520 for (i = 0; i < 16; ++i)
522 // expected-error@+1 {{use of undeclared identifier 'x'}}
523 #pragma omp parallel for simd aligned(x)
524 for (i = 0; i < 16; ++i)
526 // expected-error@+2 {{use of undeclared identifier 'x'}}
527 // expected-error@+1 {{use of undeclared identifier 'y'}}
528 #pragma omp parallel for simd aligned(x, y)
529 for (i = 0; i < 16; ++i)
531 // expected-error@+3 {{use of undeclared identifier 'x'}}
532 // expected-error@+2 {{use of undeclared identifier 'y'}}
533 // expected-error@+1 {{use of undeclared identifier 'z'}}
534 #pragma omp parallel for simd aligned(x, y, z)
535 for (i = 0; i < 16; ++i)
538 int *x, y, z[25]; // expected-note 4 {{'y' defined here}}
539 #pragma omp parallel for simd aligned(x)
540 for (i = 0; i < 16; ++i)
542 #pragma omp parallel for simd aligned(z)
543 for (i = 0; i < 16; ++i)
545 // expected-error@+1 {{expected expression}}
546 #pragma omp parallel for simd aligned(x :)
547 for (i = 0; i < 16; ++i)
549 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
550 #pragma omp parallel for simd aligned(x :, )
551 for (i = 0; i < 16; ++i)
553 #pragma omp parallel for simd aligned(x : 1)
554 for (i = 0; i < 16; ++i)
556 #pragma omp parallel for simd aligned(x : 2 * 2)
557 for (i = 0; i < 16; ++i)
559 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
560 #pragma omp parallel for simd aligned(x : 1, y)
561 for (i = 0; i < 16; ++i)
563 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
564 #pragma omp parallel for simd aligned(x : 1, y, z : 1)
565 for (i = 0; i < 16; ++i)
568 // expected-error@+1 {{argument of aligned clause should be array or pointer, not 'int'}}
569 #pragma omp parallel for simd aligned(x, y)
570 for (i = 0; i < 16; ++i)
572 // expected-error@+1 {{argument of aligned clause should be array or pointer, not 'int'}}
573 #pragma omp parallel for simd aligned(x, y, z)
574 for (i = 0; i < 16; ++i)
577 // expected-note@+2 {{defined as aligned}}
578 // expected-error@+1 {{a variable cannot appear in more than one aligned clause}}
579 #pragma omp parallel for simd aligned(x) aligned(z, x)
580 for (i = 0; i < 16; ++i)
583 // expected-note@+3 {{defined as aligned}}
584 // expected-error@+2 {{a variable cannot appear in more than one aligned clause}}
585 // expected-error@+1 2 {{argument of aligned clause should be array or pointer, not 'int'}}
586 #pragma omp parallel for simd aligned(x, y, z) aligned(y, z)
587 for (i = 0; i < 16; ++i)
592 void test_private(void) {
593 int i;
594 #pragma omp parallel
595 // expected-error@+2 {{expected expression}}
596 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
597 #pragma omp parallel for simd private(
598 for (i = 0; i < 16; ++i)
600 #pragma omp parallel
601 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
602 // expected-error@+1 2 {{expected expression}}
603 #pragma omp parallel for simd private(,
604 for (i = 0; i < 16; ++i)
606 #pragma omp parallel
607 // expected-error@+1 2 {{expected expression}}
608 #pragma omp parallel for simd private(, )
609 for (i = 0; i < 16; ++i)
611 #pragma omp parallel
612 // expected-error@+1 {{expected expression}}
613 #pragma omp parallel for simd private()
614 for (i = 0; i < 16; ++i)
616 #pragma omp parallel
617 // expected-error@+1 {{expected expression}}
618 #pragma omp parallel for simd private(int)
619 for (i = 0; i < 16; ++i)
621 #pragma omp parallel
622 // expected-error@+1 {{expected variable name}}
623 #pragma omp parallel for simd private(0)
624 for (i = 0; i < 16; ++i)
627 int x, y, z;
628 #pragma omp parallel
629 #pragma omp parallel for simd private(x)
630 for (i = 0; i < 16; ++i)
632 #pragma omp parallel
633 #pragma omp parallel for simd private(x, y)
634 for (i = 0; i < 16; ++i)
636 #pragma omp parallel
637 #pragma omp parallel for simd private(x, y, z)
638 for (i = 0; i < 16; ++i) {
639 x = y * i + z;
643 void test_lastprivate(void) {
644 int i;
645 #pragma omp parallel
646 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
647 // expected-error@+1 {{expected expression}}
648 #pragma omp parallel for simd lastprivate(
649 for (i = 0; i < 16; ++i)
652 #pragma omp parallel
653 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
654 // expected-error@+1 2 {{expected expression}}
655 #pragma omp parallel for simd lastprivate(,
656 for (i = 0; i < 16; ++i)
658 #pragma omp parallel
659 // expected-error@+1 2 {{expected expression}}
660 #pragma omp parallel for simd lastprivate(, )
661 for (i = 0; i < 16; ++i)
663 #pragma omp parallel
664 // expected-error@+1 {{expected expression}}
665 #pragma omp parallel for simd lastprivate()
666 for (i = 0; i < 16; ++i)
668 #pragma omp parallel
669 // expected-error@+1 {{expected expression}}
670 #pragma omp parallel for simd lastprivate(int)
671 for (i = 0; i < 16; ++i)
673 #pragma omp parallel
674 // expected-error@+1 {{expected variable name}}
675 #pragma omp parallel for simd lastprivate(0)
676 for (i = 0; i < 16; ++i)
679 int x, y, z;
680 #pragma omp parallel
681 #pragma omp parallel for simd lastprivate(x)
682 for (i = 0; i < 16; ++i)
684 #pragma omp parallel
685 #pragma omp parallel for simd lastprivate(x, y)
686 for (i = 0; i < 16; ++i)
688 #pragma omp parallel
689 #pragma omp parallel for simd lastprivate(x, y, z)
690 for (i = 0; i < 16; ++i)
694 void test_firstprivate(void) {
695 int i;
696 #pragma omp parallel
697 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
698 // expected-error@+1 {{expected expression}}
699 #pragma omp parallel for simd firstprivate(
700 for (i = 0; i < 16; ++i)
703 #pragma omp parallel
704 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
705 // expected-error@+1 2 {{expected expression}}
706 #pragma omp parallel for simd firstprivate(,
707 for (i = 0; i < 16; ++i)
709 #pragma omp parallel
710 // expected-error@+1 2 {{expected expression}}
711 #pragma omp parallel for simd firstprivate(, )
712 for (i = 0; i < 16; ++i)
714 #pragma omp parallel
715 // expected-error@+1 {{expected expression}}
716 #pragma omp parallel for simd firstprivate()
717 for (i = 0; i < 16; ++i)
719 #pragma omp parallel
720 // expected-error@+1 {{expected expression}}
721 #pragma omp parallel for simd firstprivate(int)
722 for (i = 0; i < 16; ++i)
724 #pragma omp parallel
725 // expected-error@+1 {{expected variable name}}
726 #pragma omp parallel for simd firstprivate(0)
727 for (i = 0; i < 16; ++i)
730 int x, y, z;
731 #pragma omp parallel
732 #pragma omp parallel for simd lastprivate(x) firstprivate(x)
733 for (i = 0; i < 16; ++i)
735 #pragma omp parallel
736 #pragma omp parallel for simd lastprivate(x, y) firstprivate(x, y)
737 for (i = 0; i < 16; ++i)
739 #pragma omp parallel
740 #pragma omp parallel for simd lastprivate(x, y, z) firstprivate(x, y, z)
741 for (i = 0; i < 16; ++i)
745 void test_loop_messages(void) {
746 float a[100], b[100], c[100];
747 #pragma omp parallel
748 // expected-error@+2 {{variable must be of integer or pointer type}}
749 #pragma omp parallel for simd
750 for (float fi = 0; fi < 10.0; fi++) {
751 c[(int)fi] = a[(int)fi] + b[(int)fi];
753 #pragma omp parallel
754 // expected-error@+2 {{variable must be of integer or pointer type}}
755 #pragma omp parallel for simd
756 for (double fi = 0; fi < 10.0; fi++) {
757 c[(int)fi] = a[(int)fi] + b[(int)fi];
761 void test_nontemporal(void) {
762 int i;
763 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
764 #pragma omp parallel for simd nontemporal(
765 for (i = 0; i < 16; ++i)
767 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} expected-error@+1 2 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
768 #pragma omp parallel for simd nontemporal(,
769 for (i = 0; i < 16; ++i)
771 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} expected-error@+1 2 {{expected expression}}
772 #pragma omp parallel for simd nontemporal(, )
773 for (i = 0; i < 16; ++i)
775 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} expected-error@+1 {{expected expression}}
776 #pragma omp parallel for simd nontemporal()
777 for (i = 0; i < 16; ++i)
779 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} expected-error@+1 {{expected expression}}
780 #pragma omp parallel for simd nontemporal(int)
781 for (i = 0; i < 16; ++i)
783 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} omp50-error@+1 {{expected variable name}} omp51-error@+1 {{expected variable name}}
784 #pragma omp parallel for simd nontemporal(0)
785 for (i = 0; i < 16; ++i)
787 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} expected-error@+1 {{use of undeclared identifier 'x'}}
788 #pragma omp parallel for simd nontemporal(x)
789 for (i = 0; i < 16; ++i)
791 // expected-error@+2 {{use of undeclared identifier 'x'}}
792 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} expected-error@+1 {{use of undeclared identifier 'y'}}
793 #pragma omp parallel for simd nontemporal(x, y)
794 for (i = 0; i < 16; ++i)
796 // expected-error@+3 {{use of undeclared identifier 'x'}}
797 // expected-error@+2 {{use of undeclared identifier 'y'}}
798 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} expected-error@+1 {{use of undeclared identifier 'z'}}
799 #pragma omp parallel for simd nontemporal(x, y, z)
800 for (i = 0; i < 16; ++i)
803 int x, y;
804 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} expected-error@+1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
805 #pragma omp parallel for simd nontemporal(x :)
806 for (i = 0; i < 16; ++i)
808 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} expected-error@+1 {{expected ',' or ')' in 'nontemporal' clause}}
809 #pragma omp parallel for simd nontemporal(x :, )
810 for (i = 0; i < 16; ++i)
813 // omp51-note@+3 {{defined as nontemporal}}
814 // omp50-note@+2 {{defined as nontemporal}}
815 // omp45-error@+1 2 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp 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}}
816 #pragma omp parallel for simd nontemporal(x) nontemporal(x)
817 for (i = 0; i < 16; ++i)
820 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}}
821 #pragma omp parallel for simd private(x) nontemporal(x)
822 for (i = 0; i < 16; ++i)
825 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}}
826 #pragma omp parallel for simd nontemporal(x) private(x)
827 for (i = 0; i < 16; ++i)
830 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} expected-note@+1 {{to match this '('}} expected-error@+1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error@+1 {{expected ')'}}
831 #pragma omp parallel for simd nontemporal(x, y : 0)
832 for (i = 0; i < 16; ++i)
835 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}}
836 #pragma omp parallel for simd nontemporal(x) lastprivate(x)
837 for (i = 0; i < 16; ++i)
840 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}}
841 #pragma omp parallel for simd lastprivate(x) nontemporal(x)
842 for (i = 0; i < 16; ++i)
844 #pragma omp parallel for simd order // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp parallel for simd'}} expected-error {{expected '(' after 'order'}}
845 for (int i = 0; i < 10; ++i)
847 #pragma omp parallel for simd order( // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp 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'}}
848 for (int i = 0; i < 10; ++i)
850 #pragma omp parallel for simd order(none // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp 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'}}
851 for (int i = 0; i < 10; ++i)
853 #pragma omp parallel for simd order(concurrent // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp parallel for simd'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
854 for (int i = 0; i < 10; ++i)
856 #pragma omp parallel for simd order(concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp parallel for simd'}}
857 for (int i = 0; i < 10; ++i)
859 #pragma omp parallel for simd order(unconstrained:) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp parallel for simd'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}} omp51-error {{expected 'concurrent' in OpenMP clause 'order'}}
860 for (int i = 0; i < 10; ++i)
862 #pragma omp parallel for simd order(reproducible:concurrent // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp parallel for simd'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
863 for (int i = 0; i < 10; ++i)
865 #pragma omp parallel for simd order(reproducible:concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp parallel for simd'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
866 for (int i = 0; i < 10; ++i)
868 #pragma omp parallel for simd order(unconstrained:concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp parallel for simd'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
869 for (int i = 0; i < 10; ++i)
871 #pragma omp parallel for simd order(concurrent) order(concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp parallel for simd'}} omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp parallel for simd'}} omp51-error {{directive '#pragma omp parallel for simd' cannot contain more than one 'order' clause}}
872 for (int i = 0; i < 10; ++i)