[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / for_simd_misc_messages.c
blob700991014b76584d7374cb8832f3b63ef9b01b7f
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 -verify %s -Wuninitialized
6 // RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=50 -verify=expected,omp50 -verify %s -Wuninitialized
7 // RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -verify=expected,omp51 -verify %s -Wuninitialized
9 void xxx(int argc) {
10 int x; // expected-note {{initialize the variable 'x' to silence this warning}}
11 #pragma omp for simd
12 for (int i = 0; i < 10; ++i)
13 argc = x; // expected-warning {{variable 'x' is uninitialized when used here}}
16 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp for simd'}}
17 #pragma omp for simd
19 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp for simd'}}
20 #pragma omp for simd foo
22 void test_no_clause(void) {
23 int i;
24 #pragma omp for simd
25 for (i = 0; i < 16; ++i)
28 // expected-error@+2 {{statement after '#pragma omp for simd' must be a for loop}}
29 #pragma omp for simd
30 ++i;
33 void test_branch_protected_scope(void) {
34 int i = 0;
35 L1:
36 ++i;
38 int x[24];
40 #pragma omp parallel
41 #pragma omp for simd
42 for (i = 0; i < 16; ++i) {
43 if (i == 5)
44 goto L1; // expected-error {{use of undeclared label 'L1'}}
45 else if (i == 6)
46 return; // expected-error {{cannot return from OpenMP region}}
47 else if (i == 7)
48 goto L2;
49 else if (i == 8) {
50 L2:
51 x[i]++;
55 if (x[0] == 0)
56 goto L2; // expected-error {{use of undeclared label 'L2'}}
57 else if (x[1] == 1)
58 goto L1;
61 void test_invalid_clause(void) {
62 int i;
63 #pragma omp parallel
64 // expected-warning@+1 {{extra tokens at the end of '#pragma omp for simd' are ignored}}
65 #pragma omp for simd foo bar
66 for (i = 0; i < 16; ++i)
70 void test_non_identifiers(void) {
71 int i, x;
73 #pragma omp parallel
74 // expected-warning@+1 {{extra tokens at the end of '#pragma omp for simd' are ignored}}
75 #pragma omp for simd;
76 for (i = 0; i < 16; ++i)
78 #pragma omp parallel
79 // expected-warning@+1 {{extra tokens at the end of '#pragma omp for simd' are ignored}}
80 #pragma omp for simd linear(x);
81 for (i = 0; i < 16; ++i)
84 #pragma omp parallel
85 // expected-warning@+1 {{extra tokens at the end of '#pragma omp for simd' are ignored}}
86 #pragma omp for simd private(x);
87 for (i = 0; i < 16; ++i)
90 #pragma omp parallel
91 // expected-warning@+1 {{extra tokens at the end of '#pragma omp for simd' are ignored}}
92 #pragma omp for simd, private(x);
93 for (i = 0; i < 16; ++i)
97 extern int foo(void);
98 void test_safelen(void) {
99 int i;
100 // expected-error@+1 {{expected '('}}
101 #pragma omp for simd safelen
102 for (i = 0; i < 16; ++i)
104 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
105 #pragma omp for simd safelen(
106 for (i = 0; i < 16; ++i)
108 // expected-error@+1 {{expected expression}}
109 #pragma omp for simd safelen()
110 for (i = 0; i < 16; ++i)
112 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
113 #pragma omp for simd safelen(,
114 for (i = 0; i < 16; ++i)
116 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
117 #pragma omp for simd safelen(, )
118 for (i = 0; i < 16; ++i)
120 // expected-warning@+2 {{extra tokens at the end of '#pragma omp for simd' are ignored}}
121 // expected-error@+1 {{expected '('}}
122 #pragma omp for simd safelen 4)
123 for (i = 0; i < 16; ++i)
125 // expected-error@+2 {{expected ')'}}
126 // expected-note@+1 {{to match this '('}}
127 #pragma omp for simd safelen(4
128 for (i = 0; i < 16; ++i)
130 // expected-error@+2 {{expected ')'}}
131 // expected-note@+1 {{to match this '('}}
132 #pragma omp for simd safelen(4,
133 for (i = 0; i < 16; ++i)
135 // expected-error@+2 {{expected ')'}}
136 // expected-note@+1 {{to match this '('}}
137 #pragma omp for simd safelen(4, )
138 for (i = 0; i < 16; ++i)
140 #pragma omp for simd safelen(4)
141 for (i = 0; i < 16; ++i)
143 // expected-error@+2 {{expected ')'}}
144 // expected-note@+1 {{to match this '('}}
145 #pragma omp for simd safelen(4 4)
146 for (i = 0; i < 16; ++i)
148 // expected-error@+2 {{expected ')'}}
149 // expected-note@+1 {{to match this '('}}
150 #pragma omp for simd safelen(4, , 4)
151 for (i = 0; i < 16; ++i)
153 #pragma omp for simd safelen(4)
154 for (i = 0; i < 16; ++i)
156 // expected-error@+2 {{expected ')'}}
157 // expected-note@+1 {{to match this '('}}
158 #pragma omp for simd safelen(4, 8)
159 for (i = 0; i < 16; ++i)
161 // expected-error@+1 {{integer constant expression}}
162 #pragma omp for simd safelen(2.5)
163 for (i = 0; i < 16; ++i)
165 // expected-error@+1 {{integer constant expression}}
166 #pragma omp for simd safelen(foo())
167 for (i = 0; i < 16; ++i)
169 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
170 #pragma omp for simd safelen(-5)
171 for (i = 0; i < 16; ++i)
173 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
174 #pragma omp for simd safelen(0)
175 for (i = 0; i < 16; ++i)
177 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
178 #pragma omp for simd safelen(5 - 5)
179 for (i = 0; i < 16; ++i)
183 void test_simdlen(void) {
184 int i;
185 // expected-error@+1 {{expected '('}}
186 #pragma omp for simd simdlen
187 for (i = 0; i < 16; ++i)
189 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
190 #pragma omp for simd simdlen(
191 for (i = 0; i < 16; ++i)
193 // expected-error@+1 {{expected expression}}
194 #pragma omp for simd simdlen()
195 for (i = 0; i < 16; ++i)
197 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
198 #pragma omp for simd simdlen(,
199 for (i = 0; i < 16; ++i)
201 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
202 #pragma omp for simd simdlen(, )
203 for (i = 0; i < 16; ++i)
205 // expected-warning@+2 {{extra tokens at the end of '#pragma omp for simd' are ignored}}
206 // expected-error@+1 {{expected '('}}
207 #pragma omp for simd simdlen 4)
208 for (i = 0; i < 16; ++i)
210 // expected-error@+2 {{expected ')'}}
211 // expected-note@+1 {{to match this '('}}
212 #pragma omp for simd simdlen(4
213 for (i = 0; i < 16; ++i)
215 // expected-error@+2 {{expected ')'}}
216 // expected-note@+1 {{to match this '('}}
217 #pragma omp for simd simdlen(4,
218 for (i = 0; i < 16; ++i)
220 // expected-error@+2 {{expected ')'}}
221 // expected-note@+1 {{to match this '('}}
222 #pragma omp for simd simdlen(4, )
223 for (i = 0; i < 16; ++i)
225 #pragma omp for simd simdlen(4)
226 for (i = 0; i < 16; ++i)
228 // expected-error@+2 {{expected ')'}}
229 // expected-note@+1 {{to match this '('}}
230 #pragma omp for simd simdlen(4 4)
231 for (i = 0; i < 16; ++i)
233 // expected-error@+2 {{expected ')'}}
234 // expected-note@+1 {{to match this '('}}
235 #pragma omp for simd simdlen(4, , 4)
236 for (i = 0; i < 16; ++i)
238 #pragma omp for simd simdlen(4)
239 for (i = 0; i < 16; ++i)
241 // expected-error@+2 {{expected ')'}}
242 // expected-note@+1 {{to match this '('}}
243 #pragma omp for simd simdlen(4, 8)
244 for (i = 0; i < 16; ++i)
246 // expected-error@+1 {{integer constant expression}}
247 #pragma omp for simd simdlen(2.5)
248 for (i = 0; i < 16; ++i)
250 // expected-error@+1 {{integer constant expression}}
251 #pragma omp for simd simdlen(foo())
252 for (i = 0; i < 16; ++i)
254 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
255 #pragma omp for simd simdlen(-5)
256 for (i = 0; i < 16; ++i)
258 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
259 #pragma omp for simd simdlen(0)
260 for (i = 0; i < 16; ++i)
262 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
263 #pragma omp for simd simdlen(5 - 5)
264 for (i = 0; i < 16; ++i)
268 void test_safelen_simdlen(void) {
269 int i;
270 // expected-error@+1 {{the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter}}
271 #pragma omp for simd simdlen(6) safelen(5)
272 for (i = 0; i < 16; ++i)
274 // expected-error@+1 {{the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter}}
275 #pragma omp for simd safelen(5) simdlen(6)
276 for (i = 0; i < 16; ++i)
280 void test_collapse(void) {
281 int i;
282 #pragma omp parallel
283 // expected-error@+1 {{expected '('}}
284 #pragma omp for simd collapse
285 for (i = 0; i < 16; ++i)
287 #pragma omp parallel
288 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
289 #pragma omp for simd collapse(
290 for (i = 0; i < 16; ++i)
292 #pragma omp parallel
293 // expected-error@+1 {{expected expression}}
294 #pragma omp for simd collapse()
295 for (i = 0; i < 16; ++i)
297 #pragma omp parallel
298 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
299 #pragma omp for simd collapse(,
300 for (i = 0; i < 16; ++i)
302 #pragma omp parallel
303 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
304 #pragma omp for simd collapse(, )
305 for (i = 0; i < 16; ++i)
307 #pragma omp parallel
308 // expected-warning@+2 {{extra tokens at the end of '#pragma omp for simd' are ignored}}
309 // expected-error@+1 {{expected '('}}
310 #pragma omp for simd collapse 4)
311 for (i = 0; i < 16; ++i)
313 #pragma omp parallel
314 // expected-error@+2 {{expected ')'}}
315 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
316 #pragma omp for simd collapse(4
317 for (i = 0; i < 16; ++i)
318 ; // expected-error {{expected 4 for loops after '#pragma omp for simd', but found only 1}}
319 #pragma omp parallel
320 // expected-error@+2 {{expected ')'}}
321 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
322 #pragma omp for simd collapse(4,
323 for (i = 0; i < 16; ++i)
324 ; // expected-error {{expected 4 for loops after '#pragma omp for simd', but found only 1}}
325 #pragma omp parallel
326 // expected-error@+2 {{expected ')'}}
327 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
328 #pragma omp for simd collapse(4, )
329 for (i = 0; i < 16; ++i)
330 ; // expected-error {{expected 4 for loops after '#pragma omp for simd', but found only 1}}
331 #pragma omp parallel
332 // expected-note@+1 {{as specified in 'collapse' clause}}
333 #pragma omp for simd collapse(4)
334 for (i = 0; i < 16; ++i)
335 ; // expected-error {{expected 4 for loops after '#pragma omp for simd', but found only 1}}
336 #pragma omp parallel
337 // expected-error@+2 {{expected ')'}}
338 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
339 #pragma omp for simd collapse(4 4)
340 for (i = 0; i < 16; ++i)
341 ; // expected-error {{expected 4 for loops after '#pragma omp for simd', but found only 1}}
342 #pragma omp parallel
343 // expected-error@+2 {{expected ')'}}
344 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
345 #pragma omp for simd collapse(4, , 4)
346 for (i = 0; i < 16; ++i)
347 ; // expected-error {{expected 4 for loops after '#pragma omp for simd', but found only 1}}
348 #pragma omp parallel
349 #pragma omp for simd collapse(4)
350 for (int i1 = 0; i1 < 16; ++i1)
351 for (int i2 = 0; i2 < 16; ++i2)
352 for (int i3 = 0; i3 < 16; ++i3)
353 for (int i4 = 0; i4 < 16; ++i4)
354 foo();
355 #pragma omp parallel
356 // expected-error@+2 {{expected ')'}}
357 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
358 #pragma omp for simd collapse(4, 8)
359 for (i = 0; i < 16; ++i)
360 ; // expected-error {{expected 4 for loops after '#pragma omp for simd', but found only 1}}
361 #pragma omp parallel
362 // expected-error@+1 {{integer constant expression}}
363 #pragma omp for simd collapse(2.5)
364 for (i = 0; i < 16; ++i)
366 #pragma omp parallel
367 // expected-error@+1 {{integer constant expression}}
368 #pragma omp for simd collapse(foo())
369 for (i = 0; i < 16; ++i)
371 #pragma omp parallel
372 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
373 #pragma omp for simd collapse(-5)
374 for (i = 0; i < 16; ++i)
376 #pragma omp parallel
377 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
378 #pragma omp for simd collapse(0)
379 for (i = 0; i < 16; ++i)
381 #pragma omp parallel
382 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
383 #pragma omp for simd collapse(5 - 5)
384 for (i = 0; i < 16; ++i)
386 #pragma omp parallel
387 #pragma omp for simd collapse(2)
388 for (i = 0; i < 16; ++i) // expected-note {{defined as lastprivate}}
389 // expected-note@+1 {{variable with automatic storage duration is predetermined as private; perhaps you forget to enclose 'omp for simd' directive into a parallel or another task region?}}
390 for (int j = 0; j < 16; ++j)
391 // expected-error@+2 2 {{reduction variable must be shared}}
392 // expected-error@+1 {{OpenMP constructs may not be nested inside a simd region}}
393 #pragma omp for simd reduction(+ : i, j)
394 for (int k = 0; k < 16; ++k)
395 i += j;
398 void test_linear(void) {
399 int i;
400 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
401 #pragma omp for simd linear(
402 for (i = 0; i < 16; ++i)
404 // expected-error@+2 {{expected expression}}
405 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
406 #pragma omp for simd linear(,
407 for (i = 0; i < 16; ++i)
409 // expected-error@+2 {{expected expression}}
410 // expected-error@+1 {{expected expression}}
411 #pragma omp for simd linear(, )
412 for (i = 0; i < 16; ++i)
414 // expected-error@+1 {{expected expression}}
415 #pragma omp for simd linear()
416 for (i = 0; i < 16; ++i)
418 // expected-error@+1 {{expected expression}}
419 #pragma omp for simd linear(int)
420 for (i = 0; i < 16; ++i)
422 // expected-error@+1 {{expected variable name}}
423 #pragma omp for simd linear(0)
424 for (i = 0; i < 16; ++i)
426 // expected-error@+1 {{use of undeclared identifier 'x'}}
427 #pragma omp for simd linear(x)
428 for (i = 0; i < 16; ++i)
430 // expected-error@+2 {{use of undeclared identifier 'x'}}
431 // expected-error@+1 {{use of undeclared identifier 'y'}}
432 #pragma omp for simd linear(x, y)
433 for (i = 0; i < 16; ++i)
435 // expected-error@+3 {{use of undeclared identifier 'x'}}
436 // expected-error@+2 {{use of undeclared identifier 'y'}}
437 // expected-error@+1 {{use of undeclared identifier 'z'}}
438 #pragma omp for simd linear(x, y, z)
439 for (i = 0; i < 16; ++i)
442 int x, y;
443 // expected-error@+1 {{expected expression}}
444 #pragma omp for simd linear(x :)
445 for (i = 0; i < 16; ++i)
447 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
448 #pragma omp for simd linear(x :, )
449 for (i = 0; i < 16; ++i)
451 #pragma omp for simd linear(x : 1)
452 for (i = 0; i < 16; ++i)
454 #pragma omp for simd linear(x : 2 * 2)
455 for (i = 0; i < 16; ++i)
457 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
458 #pragma omp for simd linear(x : 1, y)
459 for (i = 0; i < 16; ++i)
461 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
462 #pragma omp for simd linear(x : 1, y, z : 1)
463 for (i = 0; i < 16; ++i)
466 // expected-note@+2 {{defined as linear}}
467 // expected-error@+1 {{linear variable cannot be linear}}
468 #pragma omp for simd linear(x) linear(x)
469 for (i = 0; i < 16; ++i)
472 // expected-note@+2 {{defined as private}}
473 // expected-error@+1 {{private variable cannot be linear}}
474 #pragma omp for simd private(x) linear(x)
475 for (i = 0; i < 16; ++i)
478 // expected-note@+2 {{defined as linear}}
479 // expected-error@+1 {{linear variable cannot be private}}
480 #pragma omp for simd linear(x) private(x)
481 for (i = 0; i < 16; ++i)
484 // expected-warning@+1 {{zero linear step (x and other variables in clause should probably be const)}}
485 #pragma omp for simd linear(x, y : 0)
486 for (i = 0; i < 16; ++i)
489 // expected-note@+2 {{defined as linear}}
490 // expected-error@+1 {{linear variable cannot be lastprivate}}
491 #pragma omp for simd linear(x) lastprivate(x)
492 for (i = 0; i < 16; ++i)
495 #pragma omp parallel
496 // expected-note@+2 {{defined as lastprivate}}
497 // expected-error@+1 {{lastprivate variable cannot be linear}}
498 #pragma omp for simd lastprivate(x) linear(x)
499 for (i = 0; i < 16; ++i)
503 void test_aligned(void) {
504 int i;
505 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
506 #pragma omp for simd aligned(
507 for (i = 0; i < 16; ++i)
509 // expected-error@+2 {{expected expression}}
510 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
511 #pragma omp for simd aligned(,
512 for (i = 0; i < 16; ++i)
514 // expected-error@+2 {{expected expression}}
515 // expected-error@+1 {{expected expression}}
516 #pragma omp for simd aligned(, )
517 for (i = 0; i < 16; ++i)
519 // expected-error@+1 {{expected expression}}
520 #pragma omp for simd aligned()
521 for (i = 0; i < 16; ++i)
523 // expected-error@+1 {{expected expression}}
524 #pragma omp for simd aligned(int)
525 for (i = 0; i < 16; ++i)
527 // expected-error@+1 {{expected variable name}}
528 #pragma omp for simd aligned(0)
529 for (i = 0; i < 16; ++i)
531 // expected-error@+1 {{use of undeclared identifier 'x'}}
532 #pragma omp for simd aligned(x)
533 for (i = 0; i < 16; ++i)
535 // expected-error@+2 {{use of undeclared identifier 'x'}}
536 // expected-error@+1 {{use of undeclared identifier 'y'}}
537 #pragma omp for simd aligned(x, y)
538 for (i = 0; i < 16; ++i)
540 // expected-error@+3 {{use of undeclared identifier 'x'}}
541 // expected-error@+2 {{use of undeclared identifier 'y'}}
542 // expected-error@+1 {{use of undeclared identifier 'z'}}
543 #pragma omp for simd aligned(x, y, z)
544 for (i = 0; i < 16; ++i)
547 int *x, y, z[25]; // expected-note 4 {{'y' defined here}}
548 #pragma omp for simd aligned(x)
549 for (i = 0; i < 16; ++i)
551 #pragma omp for simd aligned(z)
552 for (i = 0; i < 16; ++i)
554 // expected-error@+1 {{expected expression}}
555 #pragma omp for simd aligned(x :)
556 for (i = 0; i < 16; ++i)
558 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
559 #pragma omp for simd aligned(x :, )
560 for (i = 0; i < 16; ++i)
562 #pragma omp for simd aligned(x : 1)
563 for (i = 0; i < 16; ++i)
565 #pragma omp for simd aligned(x : 2 * 2)
566 for (i = 0; i < 16; ++i)
568 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
569 #pragma omp for simd aligned(x : 1, y)
570 for (i = 0; i < 16; ++i)
572 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
573 #pragma omp for simd aligned(x : 1, y, z : 1)
574 for (i = 0; i < 16; ++i)
577 // expected-error@+1 {{argument of aligned clause should be array or pointer, not 'int'}}
578 #pragma omp for simd aligned(x, y)
579 for (i = 0; i < 16; ++i)
581 // expected-error@+1 {{argument of aligned clause should be array or pointer, not 'int'}}
582 #pragma omp for simd aligned(x, y, z)
583 for (i = 0; i < 16; ++i)
586 // expected-note@+2 {{defined as aligned}}
587 // expected-error@+1 {{a variable cannot appear in more than one aligned clause}}
588 #pragma omp for simd aligned(x) aligned(z, x)
589 for (i = 0; i < 16; ++i)
592 // expected-note@+3 {{defined as aligned}}
593 // expected-error@+2 {{a variable cannot appear in more than one aligned clause}}
594 // expected-error@+1 2 {{argument of aligned clause should be array or pointer, not 'int'}}
595 #pragma omp for simd aligned(x, y, z) aligned(y, z)
596 for (i = 0; i < 16; ++i)
601 void test_private(void) {
602 int i;
603 #pragma omp parallel
604 // expected-error@+2 {{expected expression}}
605 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
606 #pragma omp for simd private(
607 for (i = 0; i < 16; ++i)
609 #pragma omp parallel
610 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
611 // expected-error@+1 2 {{expected expression}}
612 #pragma omp for simd private(,
613 for (i = 0; i < 16; ++i)
615 #pragma omp parallel
616 // expected-error@+1 2 {{expected expression}}
617 #pragma omp for simd private(, )
618 for (i = 0; i < 16; ++i)
620 #pragma omp parallel
621 // expected-error@+1 {{expected expression}}
622 #pragma omp for simd private()
623 for (i = 0; i < 16; ++i)
625 #pragma omp parallel
626 // expected-error@+1 {{expected expression}}
627 #pragma omp for simd private(int)
628 for (i = 0; i < 16; ++i)
630 #pragma omp parallel
631 // expected-error@+1 {{expected variable name}}
632 #pragma omp for simd private(0)
633 for (i = 0; i < 16; ++i)
636 int x, y, z;
637 #pragma omp parallel
638 #pragma omp for simd private(x)
639 for (i = 0; i < 16; ++i)
641 #pragma omp parallel
642 #pragma omp for simd private(x, y)
643 for (i = 0; i < 16; ++i)
645 #pragma omp parallel
646 #pragma omp for simd private(x, y, z)
647 for (i = 0; i < 16; ++i) {
648 x = y * i + z;
652 void test_lastprivate(void) {
653 int i;
654 #pragma omp parallel
655 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
656 // expected-error@+1 {{expected expression}}
657 #pragma omp for simd lastprivate(
658 for (i = 0; i < 16; ++i)
661 #pragma omp parallel
662 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
663 // expected-error@+1 2 {{expected expression}}
664 #pragma omp for simd lastprivate(,
665 for (i = 0; i < 16; ++i)
667 #pragma omp parallel
668 // expected-error@+1 2 {{expected expression}}
669 #pragma omp for simd lastprivate(, )
670 for (i = 0; i < 16; ++i)
672 #pragma omp parallel
673 // expected-error@+1 {{expected expression}}
674 #pragma omp for simd lastprivate()
675 for (i = 0; i < 16; ++i)
677 #pragma omp parallel
678 // expected-error@+1 {{expected expression}}
679 #pragma omp for simd lastprivate(int)
680 for (i = 0; i < 16; ++i)
682 #pragma omp parallel
683 // expected-error@+1 {{expected variable name}}
684 #pragma omp for simd lastprivate(0)
685 for (i = 0; i < 16; ++i)
688 int x, y, z;
689 #pragma omp parallel
690 #pragma omp for simd lastprivate(x)
691 for (i = 0; i < 16; ++i)
693 #pragma omp parallel
694 #pragma omp for simd lastprivate(x, y)
695 for (i = 0; i < 16; ++i)
697 #pragma omp parallel
698 #pragma omp for simd lastprivate(x, y, z)
699 for (i = 0; i < 16; ++i)
703 void test_firstprivate(void) {
704 int i;
705 #pragma omp parallel
706 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
707 // expected-error@+1 {{expected expression}}
708 #pragma omp for simd firstprivate(
709 for (i = 0; i < 16; ++i)
712 #pragma omp parallel
713 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
714 // expected-error@+1 2 {{expected expression}}
715 #pragma omp for simd firstprivate(,
716 for (i = 0; i < 16; ++i)
718 #pragma omp parallel
719 // expected-error@+1 2 {{expected expression}}
720 #pragma omp for simd firstprivate(, )
721 for (i = 0; i < 16; ++i)
723 #pragma omp parallel
724 // expected-error@+1 {{expected expression}}
725 #pragma omp for simd firstprivate()
726 for (i = 0; i < 16; ++i)
728 #pragma omp parallel
729 // expected-error@+1 {{expected expression}}
730 #pragma omp for simd firstprivate(int)
731 for (i = 0; i < 16; ++i)
733 #pragma omp parallel
734 // expected-error@+1 {{expected variable name}}
735 #pragma omp for simd firstprivate(0)
736 for (i = 0; i < 16; ++i)
739 int x, y, z;
740 #pragma omp parallel
741 #pragma omp for simd lastprivate(x) firstprivate(x)
742 for (i = 0; i < 16; ++i)
744 #pragma omp parallel
745 #pragma omp for simd lastprivate(x, y) firstprivate(x, y)
746 for (i = 0; i < 16; ++i)
748 #pragma omp parallel
749 #pragma omp for simd lastprivate(x, y, z) firstprivate(x, y, z)
750 for (i = 0; i < 16; ++i)
754 void test_loop_messages(void) {
755 float a[100], b[100], c[100];
756 #pragma omp parallel
757 // expected-error@+2 {{variable must be of integer or pointer type}}
758 #pragma omp for simd
759 for (float fi = 0; fi < 10.0; fi++) {
760 c[(int)fi] = a[(int)fi] + b[(int)fi];
762 #pragma omp parallel
763 // expected-error@+2 {{variable must be of integer or pointer type}}
764 #pragma omp for simd
765 for (double fi = 0; fi < 10.0; fi++) {
766 c[(int)fi] = a[(int)fi] + b[(int)fi];
770 void test_nontemporal(void) {
771 int i;
772 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
773 #pragma omp for simd nontemporal(
774 for (i = 0; i < 16; ++i)
776 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} expected-error@+1 2 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
777 #pragma omp for simd nontemporal(,
778 for (i = 0; i < 16; ++i)
780 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} expected-error@+1 2 {{expected expression}}
781 #pragma omp for simd nontemporal(, )
782 for (i = 0; i < 16; ++i)
784 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} expected-error@+1 {{expected expression}}
785 #pragma omp for simd nontemporal()
786 for (i = 0; i < 16; ++i)
788 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} expected-error@+1 {{expected expression}}
789 #pragma omp for simd nontemporal(int)
790 for (i = 0; i < 16; ++i)
792 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} omp50-error@+1 {{expected variable name}} omp51-error@+1 {{expected variable name}}
793 #pragma omp for simd nontemporal(0)
794 for (i = 0; i < 16; ++i)
796 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} expected-error@+1 {{use of undeclared identifier 'x'}}
797 #pragma omp for simd nontemporal(x)
798 for (i = 0; i < 16; ++i)
800 // expected-error@+2 {{use of undeclared identifier 'x'}}
801 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} expected-error@+1 {{use of undeclared identifier 'y'}}
802 #pragma omp for simd nontemporal(x, y)
803 for (i = 0; i < 16; ++i)
805 // expected-error@+3 {{use of undeclared identifier 'x'}}
806 // expected-error@+2 {{use of undeclared identifier 'y'}}
807 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} expected-error@+1 {{use of undeclared identifier 'z'}}
808 #pragma omp for simd nontemporal(x, y, z)
809 for (i = 0; i < 16; ++i)
812 int x, y;
813 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} expected-error@+1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
814 #pragma omp for simd nontemporal(x :)
815 for (i = 0; i < 16; ++i)
817 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} expected-error@+1 {{expected ',' or ')' in 'nontemporal' clause}}
818 #pragma omp for simd nontemporal(x :, )
819 for (i = 0; i < 16; ++i)
822 // omp51-note@+3 {{defined as nontemporal}}
823 // omp50-note@+2 {{defined as nontemporal}}
824 // omp45-error@+1 2 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp 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}}
825 #pragma omp for simd nontemporal(x) nontemporal(x)
826 for (i = 0; i < 16; ++i)
829 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}}
830 #pragma omp for simd private(x) nontemporal(x)
831 for (i = 0; i < 16; ++i)
834 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}}
835 #pragma omp for simd nontemporal(x) private(x)
836 for (i = 0; i < 16; ++i)
839 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} expected-note@+1 {{to match this '('}} expected-error@+1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error@+1 {{expected ')'}}
840 #pragma omp for simd nontemporal(x, y : 0)
841 for (i = 0; i < 16; ++i)
844 #pragma omp parallel
845 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}}
846 #pragma omp for simd nontemporal(x) lastprivate(x)
847 for (i = 0; i < 16; ++i)
850 #pragma omp parallel
851 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}}
852 #pragma omp for simd lastprivate(x) nontemporal(x)
853 for (i = 0; i < 16; ++i)
855 #pragma omp for simd order // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp for simd'}} expected-error {{expected '(' after 'order'}}
856 for (int i = 0; i < 10; ++i)
858 #pragma omp for simd order( // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp 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'}}
859 for (int i = 0; i < 10; ++i)
861 #pragma omp for simd order(none // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp 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'}}
862 for (int i = 0; i < 10; ++i)
864 #pragma omp for simd order(concurrent // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp for simd'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
865 for (int i = 0; i < 10; ++i)
867 #pragma omp for simd order(concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp for simd'}}
868 for (int i = 0; i < 10; ++i)
870 #pragma omp for simd order(unconstrained:) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp for simd'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}} omp51-error {{expected 'concurrent' in OpenMP clause 'order'}}
871 for (int i = 0; i < 10; ++i)
873 #pragma omp for simd order(reproducible:concurrent // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp for simd'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
874 for (int i = 0; i < 10; ++i)
876 #pragma omp for simd order(reproducible:concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp for simd'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
877 for (int i = 0; i < 10; ++i)
879 #pragma omp for simd order(unconstrained:concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp for simd'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
880 for (int i = 0; i < 10; ++i)
882 #pragma omp for simd order(concurrent) order(concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp for simd'}} omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp for simd'}} omp51-error {{directive '#pragma omp for simd' cannot contain more than one 'order' clause}}
883 for (int i = 0; i < 10; ++i)