Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / simd_misc_messages.c
blob745e5b965cfdefe47896e9a29760385673ab03ca
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 -fopenmp-version=51 -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 -fopenmp-version=51 -verify=expected,omp51 %s -Wuninitialized
9 void xxx(int argc) {
10 int x; // expected-note {{initialize the variable 'x' to silence this warning}}
11 #pragma omp 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 simd'}}
17 #pragma omp simd
19 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp simd'}}
20 #pragma omp simd foo
22 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp simd'}}
23 #pragma omp simd safelen(4)
25 void test_no_clause(void) {
26 int i;
27 #pragma omp simd
28 for (i = 0; i < 16; ++i)
31 // expected-error@+2 {{statement after '#pragma omp simd' must be a for loop}}
32 #pragma omp simd
33 ++i;
36 void test_branch_protected_scope(void) {
37 int i = 0;
38 L1:
39 ++i;
41 int x[24];
43 #pragma omp simd
44 for (i = 0; i < 16; ++i) {
45 if (i == 5)
46 goto L1; // expected-error {{use of undeclared label 'L1'}}
47 else if (i == 6)
48 return; // expected-error {{cannot return from OpenMP region}}
49 else if (i == 7)
50 goto L2;
51 else if (i == 8) {
52 L2:
53 x[i]++;
57 if (x[0] == 0)
58 goto L2; // expected-error {{use of undeclared label 'L2'}}
59 else if (x[1] == 1)
60 goto L1;
63 void test_invalid_clause(void) {
64 int i;
65 // expected-warning@+1 {{extra tokens at the end of '#pragma omp simd' are ignored}}
66 #pragma omp simd foo bar
67 for (i = 0; i < 16; ++i)
71 void test_non_identifiers(void) {
72 int i, x;
74 // expected-warning@+1 {{extra tokens at the end of '#pragma omp simd' are ignored}}
75 #pragma omp simd;
76 for (i = 0; i < 16; ++i)
78 // expected-error@+2 {{unexpected OpenMP clause 'firstprivate' in directive '#pragma omp simd'}}
79 // expected-warning@+1 {{extra tokens at the end of '#pragma omp simd' are ignored}}
80 #pragma omp simd firstprivate(x);
81 for (i = 0; i < 16; ++i)
84 // expected-warning@+1 {{extra tokens at the end of '#pragma omp simd' are ignored}}
85 #pragma omp simd private(x);
86 for (i = 0; i < 16; ++i)
89 // expected-warning@+1 {{extra tokens at the end of '#pragma omp simd' are ignored}}
90 #pragma omp simd, private(x);
91 for (i = 0; i < 16; ++i)
95 extern int foo(void);
96 void test_safelen(void) {
97 int i;
98 // expected-error@+1 {{expected '('}}
99 #pragma omp simd safelen
100 for (i = 0; i < 16; ++i)
102 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
103 #pragma omp simd safelen(
104 for (i = 0; i < 16; ++i)
106 // expected-error@+1 {{expected expression}}
107 #pragma omp simd safelen()
108 for (i = 0; i < 16; ++i)
110 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
111 #pragma omp simd safelen(,
112 for (i = 0; i < 16; ++i)
114 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
115 #pragma omp simd safelen(, )
116 for (i = 0; i < 16; ++i)
118 // expected-warning@+2 {{extra tokens at the end of '#pragma omp simd' are ignored}}
119 // expected-error@+1 {{expected '('}}
120 #pragma omp 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 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 simd safelen(4,
131 for (i = 0; i < 16; ++i)
133 // expected-error@+2 {{expected ')'}}
134 // expected-note@+1 {{to match this '('}}
135 #pragma omp simd safelen(4, )
136 for (i = 0; i < 16; ++i)
138 // xxpected-error@+1 {{expected expression}}
139 #pragma omp simd safelen(4)
140 for (i = 0; i < 16; ++i)
142 // expected-error@+2 {{expected ')'}}
143 // expected-note@+1 {{to match this '('}}
144 #pragma omp simd safelen(4 4)
145 for (i = 0; i < 16; ++i)
147 // expected-error@+2 {{expected ')'}}
148 // expected-note@+1 {{to match this '('}}
149 #pragma omp simd safelen(4, , 4)
150 for (i = 0; i < 16; ++i)
152 #pragma omp simd safelen(4)
153 for (i = 0; i < 16; ++i)
155 // expected-error@+2 {{expected ')'}}
156 // expected-note@+1 {{to match this '('}}
157 #pragma omp simd safelen(4, 8)
158 for (i = 0; i < 16; ++i)
160 // expected-error@+1 {{integer constant expression}}
161 #pragma omp simd safelen(2.5)
162 for (i = 0; i < 16; ++i)
164 // expected-error@+1 {{integer constant expression}}
165 #pragma omp simd safelen(foo())
166 for (i = 0; i < 16; ++i)
168 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
169 #pragma omp simd safelen(-5)
170 for (i = 0; i < 16; ++i)
172 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
173 #pragma omp simd safelen(0)
174 for (i = 0; i < 16; ++i)
176 // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
177 #pragma omp simd safelen(5 - 5)
178 for (i = 0; i < 16; ++i)
182 void test_simdlen(void) {
183 int i;
184 // expected-error@+1 {{expected '('}}
185 #pragma omp simd simdlen
186 for (i = 0; i < 16; ++i)
188 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
189 #pragma omp simd simdlen(
190 for (i = 0; i < 16; ++i)
192 // expected-error@+1 {{expected expression}}
193 #pragma omp simd simdlen()
194 for (i = 0; i < 16; ++i)
196 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
197 #pragma omp simd simdlen(,
198 for (i = 0; i < 16; ++i)
200 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
201 #pragma omp simd simdlen(, )
202 for (i = 0; i < 16; ++i)
204 // expected-warning@+2 {{extra tokens at the end of '#pragma omp simd' are ignored}}
205 // expected-error@+1 {{expected '('}}
206 #pragma omp simd simdlen 4)
207 for (i = 0; i < 16; ++i)
209 // expected-error@+2 {{expected ')'}}
210 // expected-note@+1 {{to match this '('}}
211 #pragma omp simd simdlen(4
212 for (i = 0; i < 16; ++i)
214 // expected-error@+2 {{expected ')'}}
215 // expected-note@+1 {{to match this '('}}
216 #pragma omp simd simdlen(4,
217 for (i = 0; i < 16; ++i)
219 // expected-error@+2 {{expected ')'}}
220 // expected-note@+1 {{to match this '('}}
221 #pragma omp simd simdlen(4, )
222 for (i = 0; i < 16; ++i)
224 #pragma omp simd simdlen(4)
225 for (i = 0; i < 16; ++i)
227 // expected-error@+2 {{expected ')'}}
228 // expected-note@+1 {{to match this '('}}
229 #pragma omp simd simdlen(4 4)
230 for (i = 0; i < 16; ++i)
232 // expected-error@+2 {{expected ')'}}
233 // expected-note@+1 {{to match this '('}}
234 #pragma omp simd simdlen(4, , 4)
235 for (i = 0; i < 16; ++i)
237 #pragma omp simd simdlen(4)
238 for (i = 0; i < 16; ++i)
240 // expected-error@+2 {{expected ')'}}
241 // expected-note@+1 {{to match this '('}}
242 #pragma omp simd simdlen(4, 8)
243 for (i = 0; i < 16; ++i)
245 // expected-error@+1 {{integer constant expression}}
246 #pragma omp simd simdlen(2.5)
247 for (i = 0; i < 16; ++i)
249 // expected-error@+1 {{integer constant expression}}
250 #pragma omp simd simdlen(foo())
251 for (i = 0; i < 16; ++i)
253 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
254 #pragma omp simd simdlen(-5)
255 for (i = 0; i < 16; ++i)
257 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
258 #pragma omp simd simdlen(0)
259 for (i = 0; i < 16; ++i)
261 // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
262 #pragma omp simd simdlen(5 - 5)
263 for (i = 0; i < 16; ++i)
267 void test_safelen_simdlen(void) {
268 int i;
269 // expected-error@+1 {{the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter}}
270 #pragma omp simd simdlen(6) safelen(5)
271 for (i = 0; i < 16; ++i)
273 // expected-error@+1 {{the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter}}
274 #pragma omp simd safelen(5) simdlen(6)
275 for (i = 0; i < 16; ++i)
279 void test_collapse(void) {
280 int i;
281 // expected-error@+1 {{expected '('}}
282 #pragma omp simd collapse
283 for (i = 0; i < 16; ++i)
285 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
286 #pragma omp simd collapse(
287 for (i = 0; i < 16; ++i)
289 // expected-error@+1 {{expected expression}}
290 #pragma omp simd collapse()
291 for (i = 0; i < 16; ++i)
293 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
294 #pragma omp simd collapse(,
295 for (i = 0; i < 16; ++i)
297 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
298 #pragma omp simd collapse(, )
299 for (i = 0; i < 16; ++i)
301 // expected-warning@+2 {{extra tokens at the end of '#pragma omp simd' are ignored}}
302 // expected-error@+1 {{expected '('}}
303 #pragma omp simd collapse 4)
304 for (i = 0; i < 16; ++i)
306 // expected-error@+2 {{expected ')'}}
307 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
308 #pragma omp simd collapse(4
309 for (i = 0; i < 16; ++i)
310 ; // expected-error {{expected 4 for loops after '#pragma omp simd', but found only 1}}
311 // expected-error@+2 {{expected ')'}}
312 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
313 #pragma omp simd collapse(4,
314 for (i = 0; i < 16; ++i)
315 ; // expected-error {{expected 4 for loops after '#pragma omp simd', but found only 1}}
316 // expected-error@+2 {{expected ')'}}
317 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
318 #pragma omp simd collapse(4, )
319 for (i = 0; i < 16; ++i)
320 ; // expected-error {{expected 4 for loops after '#pragma omp simd', but found only 1}}
321 // xxpected-error@+1 {{expected expression}} expected-note@+1 {{as specified in 'collapse' clause}}
322 #pragma omp simd collapse(4)
323 for (i = 0; i < 16; ++i)
324 ; // expected-error {{expected 4 for loops after '#pragma omp simd', but found only 1}}
325 // expected-error@+2 {{expected ')'}}
326 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
327 #pragma omp simd collapse(4 4)
328 for (i = 0; i < 16; ++i)
329 ; // expected-error {{expected 4 for loops after '#pragma omp simd', but found only 1}}
330 // expected-error@+2 {{expected ')'}}
331 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
332 #pragma omp simd collapse(4, , 4)
333 for (i = 0; i < 16; ++i)
334 ; // expected-error {{expected 4 for loops after '#pragma omp simd', but found only 1}}
335 #pragma omp simd collapse(4)
336 for (int i1 = 0; i1 < 16; ++i1)
337 for (int i2 = 0; i2 < 16; ++i2)
338 for (int i3 = 0; i3 < 16; ++i3)
339 for (int i4 = 0; i4 < 16; ++i4)
340 foo();
341 // expected-error@+2 {{expected ')'}}
342 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
343 #pragma omp simd collapse(4, 8)
344 for (i = 0; i < 16; ++i)
345 ; // expected-error {{expected 4 for loops after '#pragma omp simd', but found only 1}}
346 // expected-error@+1 {{integer constant expression}}
347 #pragma omp simd collapse(2.5)
348 for (i = 0; i < 16; ++i)
350 // expected-error@+1 {{integer constant expression}}
351 #pragma omp simd collapse(foo())
352 for (i = 0; i < 16; ++i)
354 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
355 #pragma omp simd collapse(-5)
356 for (i = 0; i < 16; ++i)
358 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
359 #pragma omp simd collapse(0)
360 for (i = 0; i < 16; ++i)
362 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
363 #pragma omp simd collapse(5 - 5)
364 for (i = 0; i < 16; ++i)
366 // expected-note@+2 2 {{defined as reduction}}
367 #pragma omp parallel
368 #pragma omp simd collapse(2) reduction(+ : i)
369 for (i = 0; i < 16; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp simd' directive may not be reduction, predetermined as lastprivate}}
370 // 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?}}
371 for (int j = 0; j < 16; ++j)
372 // expected-error@+2 2 {{reduction variable must be shared}}
373 // expected-error@+1 {{OpenMP constructs may not be nested inside a simd region}}
374 #pragma omp for reduction(+ : i, j)
375 for (int k = 0; k < 16; ++k)
376 i += j;
377 #pragma omp parallel
378 #pragma omp for
379 for (i = 0; i < 16; ++i)
380 for (int j = 0; j < 16; ++j)
381 #pragma omp simd reduction(+ : i, j)
382 for (int k = 0; k < 16; ++k)
383 i += j;
386 void test_linear(void) {
387 int i;
388 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
389 #pragma omp simd linear(
390 for (i = 0; i < 16; ++i)
392 // expected-error@+2 {{expected expression}}
393 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
394 #pragma omp simd linear(,
395 for (i = 0; i < 16; ++i)
397 // expected-error@+2 {{expected expression}}
398 // expected-error@+1 {{expected expression}}
399 #pragma omp simd linear(, )
400 for (i = 0; i < 16; ++i)
402 // expected-error@+1 {{expected expression}}
403 #pragma omp simd linear()
404 for (i = 0; i < 16; ++i)
406 // expected-error@+1 {{expected expression}}
407 #pragma omp simd linear(int)
408 for (i = 0; i < 16; ++i)
410 // expected-error@+1 {{expected variable name}}
411 #pragma omp simd linear(0)
412 for (i = 0; i < 16; ++i)
414 // expected-error@+1 {{use of undeclared identifier 'x'}}
415 #pragma omp simd linear(x)
416 for (i = 0; i < 16; ++i)
418 // expected-error@+2 {{use of undeclared identifier 'x'}}
419 // expected-error@+1 {{use of undeclared identifier 'y'}}
420 #pragma omp simd linear(x, y)
421 for (i = 0; i < 16; ++i)
423 // expected-error@+3 {{use of undeclared identifier 'x'}}
424 // expected-error@+2 {{use of undeclared identifier 'y'}}
425 // expected-error@+1 {{use of undeclared identifier 'z'}}
426 #pragma omp simd linear(x, y, z)
427 for (i = 0; i < 16; ++i)
430 int x, y;
431 // expected-error@+1 {{expected expression}}
432 #pragma omp simd linear(x :)
433 for (i = 0; i < 16; ++i)
435 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
436 #pragma omp simd linear(x :, )
437 for (i = 0; i < 16; ++i)
439 #pragma omp simd linear(x : 1)
440 for (i = 0; i < 16; ++i)
442 #pragma omp simd linear(x : 2 * 2)
443 for (i = 0; i < 16; ++i)
445 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
446 #pragma omp simd linear(x : 1, y)
447 for (i = 0; i < 16; ++i)
449 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
450 #pragma omp simd linear(x : 1, y, z : 1)
451 for (i = 0; i < 16; ++i)
454 // expected-note@+2 {{defined as linear}}
455 // expected-error@+1 {{linear variable cannot be linear}}
456 #pragma omp simd linear(x) linear(x)
457 for (i = 0; i < 16; ++i)
460 // expected-note@+2 {{defined as private}}
461 // expected-error@+1 {{private variable cannot be linear}}
462 #pragma omp simd private(x) linear(x)
463 for (i = 0; i < 16; ++i)
466 // expected-note@+2 {{defined as linear}}
467 // expected-error@+1 {{linear variable cannot be private}}
468 #pragma omp simd linear(x) private(x)
469 for (i = 0; i < 16; ++i)
472 // expected-warning@+1 {{zero linear step (x and other variables in clause should probably be const)}}
473 #pragma omp simd linear(x, y : 0)
474 for (i = 0; i < 16; ++i)
477 // expected-note@+2 {{defined as linear}}
478 // expected-error@+1 {{linear variable cannot be lastprivate}}
479 #pragma omp simd linear(x) lastprivate(x)
480 for (i = 0; i < 16; ++i)
483 // expected-note@+2 {{defined as lastprivate}}
484 // expected-error@+1 {{lastprivate variable cannot be linear}}
485 #pragma omp simd lastprivate(x) linear(x)
486 for (i = 0; i < 16; ++i)
490 void test_aligned(void) {
491 int i;
492 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
493 #pragma omp simd aligned(
494 for (i = 0; i < 16; ++i)
496 // expected-error@+2 {{expected expression}}
497 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
498 #pragma omp simd aligned(,
499 for (i = 0; i < 16; ++i)
501 // expected-error@+2 {{expected expression}}
502 // expected-error@+1 {{expected expression}}
503 #pragma omp simd aligned(, )
504 for (i = 0; i < 16; ++i)
506 // expected-error@+1 {{expected expression}}
507 #pragma omp simd aligned()
508 for (i = 0; i < 16; ++i)
510 // expected-error@+1 {{expected expression}}
511 #pragma omp simd aligned(int)
512 for (i = 0; i < 16; ++i)
514 // expected-error@+1 {{expected variable name}}
515 #pragma omp simd aligned(0)
516 for (i = 0; i < 16; ++i)
518 // expected-error@+1 {{use of undeclared identifier 'x'}}
519 #pragma omp simd aligned(x)
520 for (i = 0; i < 16; ++i)
522 // expected-error@+2 {{use of undeclared identifier 'x'}}
523 // expected-error@+1 {{use of undeclared identifier 'y'}}
524 #pragma omp simd aligned(x, y)
525 for (i = 0; i < 16; ++i)
527 // expected-error@+3 {{use of undeclared identifier 'x'}}
528 // expected-error@+2 {{use of undeclared identifier 'y'}}
529 // expected-error@+1 {{use of undeclared identifier 'z'}}
530 #pragma omp simd aligned(x, y, z)
531 for (i = 0; i < 16; ++i)
534 int *x, y, z[25]; // expected-note 4 {{'y' defined here}}
535 #pragma omp simd aligned(x)
536 for (i = 0; i < 16; ++i)
538 #pragma omp simd aligned(z)
539 for (i = 0; i < 16; ++i)
541 // expected-error@+1 {{expected expression}}
542 #pragma omp simd aligned(x :)
543 for (i = 0; i < 16; ++i)
545 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
546 #pragma omp simd aligned(x :, )
547 for (i = 0; i < 16; ++i)
549 #pragma omp simd aligned(x : 1)
550 for (i = 0; i < 16; ++i)
552 #pragma omp simd aligned(x : 2 * 2)
553 for (i = 0; i < 16; ++i)
555 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
556 #pragma omp simd aligned(x : 1, y)
557 for (i = 0; i < 16; ++i)
559 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
560 #pragma omp simd aligned(x : 1, y, z : 1)
561 for (i = 0; i < 16; ++i)
564 // expected-error@+1 {{argument of aligned clause should be array or pointer, not 'int'}}
565 #pragma omp simd aligned(x, y)
566 for (i = 0; i < 16; ++i)
568 // expected-error@+1 {{argument of aligned clause should be array or pointer, not 'int'}}
569 #pragma omp simd aligned(x, y, z)
570 for (i = 0; i < 16; ++i)
573 // expected-note@+2 {{defined as aligned}}
574 // expected-error@+1 {{a variable cannot appear in more than one aligned clause}}
575 #pragma omp simd aligned(x) aligned(z, x)
576 for (i = 0; i < 16; ++i)
579 // expected-note@+3 {{defined as aligned}}
580 // expected-error@+2 {{a variable cannot appear in more than one aligned clause}}
581 // expected-error@+1 2 {{argument of aligned clause should be array or pointer, not 'int'}}
582 #pragma omp simd aligned(x, y, z) aligned(y, z)
583 for (i = 0; i < 16; ++i)
587 void test_private(void) {
588 int i;
589 // expected-error@+2 {{expected expression}}
590 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
591 #pragma omp simd private(
592 for (i = 0; i < 16; ++i)
594 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
595 // expected-error@+1 2 {{expected expression}}
596 #pragma omp simd private(,
597 for (i = 0; i < 16; ++i)
599 // expected-error@+1 2 {{expected expression}}
600 #pragma omp simd private(, )
601 for (i = 0; i < 16; ++i)
603 // expected-error@+1 {{expected expression}}
604 #pragma omp simd private()
605 for (i = 0; i < 16; ++i)
607 // expected-error@+1 {{expected expression}}
608 #pragma omp simd private(int)
609 for (i = 0; i < 16; ++i)
611 // expected-error@+1 {{expected variable name}}
612 #pragma omp simd private(0)
613 for (i = 0; i < 16; ++i)
616 int x, y, z;
617 #pragma omp simd private(x)
618 for (i = 0; i < 16; ++i)
620 #pragma omp simd private(x, y)
621 for (i = 0; i < 16; ++i)
623 #pragma omp simd private(x, y, z)
624 for (i = 0; i < 16; ++i) {
625 x = y * i + z;
629 void test_firstprivate(void) {
630 int i;
631 // expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}}
632 // expected-error@+2 {{unexpected OpenMP clause 'firstprivate' in directive '#pragma omp simd'}}
633 // expected-error@+1 {{expected expression}}
634 #pragma omp simd firstprivate(
635 for (i = 0; i < 16; ++i)
639 void test_lastprivate(void) {
640 int i;
641 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
642 // expected-error@+1 {{expected expression}}
643 #pragma omp simd lastprivate(
644 for (i = 0; i < 16; ++i)
647 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
648 // expected-error@+1 2 {{expected expression}}
649 #pragma omp simd lastprivate(,
650 for (i = 0; i < 16; ++i)
652 // expected-error@+1 2 {{expected expression}}
653 #pragma omp simd lastprivate(, )
654 for (i = 0; i < 16; ++i)
656 // expected-error@+1 {{expected expression}}
657 #pragma omp simd lastprivate()
658 for (i = 0; i < 16; ++i)
660 // expected-error@+1 {{expected expression}}
661 #pragma omp simd lastprivate(int)
662 for (i = 0; i < 16; ++i)
664 // expected-error@+1 {{expected variable name}}
665 #pragma omp simd lastprivate(0)
666 for (i = 0; i < 16; ++i)
669 int x, y, z;
670 #pragma omp simd lastprivate(x)
671 for (i = 0; i < 16; ++i)
673 #pragma omp simd lastprivate(x, y)
674 for (i = 0; i < 16; ++i)
676 #pragma omp simd lastprivate(x, y, z)
677 for (i = 0; i < 16; ++i)
681 void test_reduction(void) {
682 int i, x, y;
683 // expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}}
684 // expected-error@+2 {{expected identifier}}
685 // expected-warning@+1 {{missing ':' after reduction identifier - ignoring}}
686 #pragma omp simd reduction(
687 for (i = 0; i < 16; ++i)
689 // expected-error@+2 {{expected identifier}}
690 // expected-warning@+1 {{missing ':' after reduction identifier - ignoring}}
691 #pragma omp simd reduction()
692 for (i = 0; i < 16; ++i)
694 // expected-error@+2 {{expected expression}}
695 // expected-warning@+1 {{missing ':' after reduction identifier - ignoring}}
696 #pragma omp simd reduction(x)
697 for (i = 0; i < 16; ++i)
699 // expected-error@+1 {{expected identifier}}
700 #pragma omp simd reduction( : x)
701 for (i = 0; i < 16; ++i)
703 // expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}}
704 // expected-error@+2 {{expected identifier}}
705 // expected-warning@+1 {{missing ':' after reduction identifier - ignoring}}
706 #pragma omp simd reduction(,
707 for (i = 0; i < 16; ++i)
709 // expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}}
710 // expected-error@+2 {{expected expression}}
711 // expected-warning@+1 {{missing ':' after reduction identifier - ignoring}}
712 #pragma omp simd reduction(+
713 for (i = 0; i < 16; ++i)
716 // expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}}
718 // expected-error@+1 {{expected expression}}
719 #pragma omp simd reduction(+:
720 for (i = 0; i < 16; ++i)
722 // expected-error@+1 {{expected expression}}
723 #pragma omp simd reduction(+ :)
724 for (i = 0; i < 16; ++i)
726 // expected-error@+1 {{expected expression}}
727 #pragma omp simd reduction(+ :, y)
728 for (i = 0; i < 16; ++i)
730 // expected-error@+1 {{expected expression}}
731 #pragma omp simd reduction(+ : x, + : y)
732 for (i = 0; i < 16; ++i)
734 // expected-error@+1 {{expected identifier}}
735 #pragma omp simd reduction(% : x)
736 for (i = 0; i < 16; ++i)
739 #pragma omp simd reduction(+ : x)
740 for (i = 0; i < 16; ++i)
742 #pragma omp simd reduction(* : x)
743 for (i = 0; i < 16; ++i)
745 #pragma omp simd reduction(- : x)
746 for (i = 0; i < 16; ++i)
748 #pragma omp simd reduction(& : x)
749 for (i = 0; i < 16; ++i)
751 #pragma omp simd reduction(| : x)
752 for (i = 0; i < 16; ++i)
754 #pragma omp simd reduction(^ : x)
755 for (i = 0; i < 16; ++i)
757 #pragma omp simd reduction(&& : x)
758 for (i = 0; i < 16; ++i)
760 #pragma omp simd reduction(|| : x)
761 for (i = 0; i < 16; ++i)
763 #pragma omp simd reduction(max : x)
764 for (i = 0; i < 16; ++i)
766 #pragma omp simd reduction(min : x)
767 for (i = 0; i < 16; ++i)
769 struct X {
770 int x;
772 struct X X;
773 // expected-error@+1 {{expected variable name}}
774 #pragma omp simd reduction(+ : X.x)
775 for (i = 0; i < 16; ++i)
777 // expected-error@+1 {{expected variable name}}
778 #pragma omp simd reduction(+ : x + x)
779 for (i = 0; i < 16; ++i)
783 void test_loop_messages(void) {
784 float a[100], b[100], c[100];
785 // expected-error@+2 {{variable must be of integer or pointer type}}
786 #pragma omp simd
787 for (float fi = 0; fi < 10.0; fi++) {
788 c[(int)fi] = a[(int)fi] + b[(int)fi];
790 // expected-error@+2 {{variable must be of integer or pointer type}}
791 #pragma omp simd
792 for (double fi = 0; fi < 10.0; fi++) {
793 c[(int)fi] = a[(int)fi] + b[(int)fi];
797 void linear_modifiers(int argc) {
798 int f;
799 #pragma omp simd linear(f)
800 for (int k = 0; k < argc; ++k) ++k;
801 #pragma omp simd linear(val(f))
802 for (int k = 0; k < argc; ++k) ++k;
803 #pragma omp simd linear(uval(f)) // expected-error {{expected 'val' modifier}}
804 for (int k = 0; k < argc; ++k) ++k;
805 #pragma omp simd linear(ref(f)) // expected-error {{expected 'val' modifier}}
806 for (int k = 0; k < argc; ++k) ++k;
807 #pragma omp simd linear(foo(f)) // expected-error {{expected 'val' modifier}}
808 for (int k = 0; k < argc; ++k) ++k;
811 void test_nontemporal(void) {
812 int i;
813 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
814 #pragma omp simd nontemporal(
815 for (i = 0; i < 16; ++i)
817 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} expected-error@+1 2 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
818 #pragma omp simd nontemporal(,
819 for (i = 0; i < 16; ++i)
821 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} expected-error@+1 2 {{expected expression}}
822 #pragma omp simd nontemporal(, )
823 for (i = 0; i < 16; ++i)
825 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} expected-error@+1 {{expected expression}}
826 #pragma omp simd nontemporal()
827 for (i = 0; i < 16; ++i)
829 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} expected-error@+1 {{expected expression}}
830 #pragma omp simd nontemporal(int)
831 for (i = 0; i < 16; ++i)
833 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} omp50-error@+1 {{expected variable name}} omp51-error@+1 {{expected variable name}}
834 #pragma omp simd nontemporal(0)
835 for (i = 0; i < 16; ++i)
837 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} expected-error@+1 {{use of undeclared identifier 'x'}}
838 #pragma omp simd nontemporal(x)
839 for (i = 0; i < 16; ++i)
841 // expected-error@+2 {{use of undeclared identifier 'x'}}
842 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} expected-error@+1 {{use of undeclared identifier 'y'}}
843 #pragma omp simd nontemporal(x, y)
844 for (i = 0; i < 16; ++i)
846 // expected-error@+3 {{use of undeclared identifier 'x'}}
847 // expected-error@+2 {{use of undeclared identifier 'y'}}
848 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} expected-error@+1 {{use of undeclared identifier 'z'}}
849 #pragma omp simd nontemporal(x, y, z)
850 for (i = 0; i < 16; ++i)
853 int x, y;
854 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} expected-error@+1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
855 #pragma omp simd nontemporal(x :)
856 for (i = 0; i < 16; ++i)
858 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} expected-error@+1 {{expected ',' or ')' in 'nontemporal' clause}}
859 #pragma omp simd nontemporal(x :, )
860 for (i = 0; i < 16; ++i)
863 // omp51-note@+3 {{defined as nontemporal}}
864 // omp50-note@+2 {{defined as nontemporal}}
865 // omp45-error@+1 2 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp 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}}
866 #pragma omp simd nontemporal(x) nontemporal(x)
867 for (i = 0; i < 16; ++i)
870 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}}
871 #pragma omp simd private(x) nontemporal(x)
872 for (i = 0; i < 16; ++i)
875 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}}
876 #pragma omp simd nontemporal(x) private(x)
877 for (i = 0; i < 16; ++i)
880 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} expected-note@+1 {{to match this '('}} expected-error@+1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error@+1 {{expected ')'}}
881 #pragma omp simd nontemporal(x, y : 0)
882 for (i = 0; i < 16; ++i)
885 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}}
886 #pragma omp simd nontemporal(x) lastprivate(x)
887 for (i = 0; i < 16; ++i)
890 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}}
891 #pragma omp simd lastprivate(x) nontemporal(x)
892 for (i = 0; i < 16; ++i)
894 #pragma omp simd order // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp simd'}} expected-error {{expected '(' after 'order'}}
895 for (int i = 0; i < 10; ++i)
897 #pragma omp simd order( // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp 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'}}
898 for (int i = 0; i < 10; ++i)
900 #pragma omp simd order(none // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp 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'}}
901 for (int i = 0; i < 10; ++i)
903 #pragma omp simd order(concurrent // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp simd'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
904 for (int i = 0; i < 10; ++i)
906 #pragma omp simd order(concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp simd'}}
907 for (int i = 0; i < 10; ++i)
909 #pragma omp simd order(unconstrained:) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp simd'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}} omp51-error {{expected 'concurrent' in OpenMP clause 'order'}}
910 for (int i = 0; i < 10; ++i)
912 #pragma omp simd order(reproducible:concurrent // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp simd'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
913 for (int i = 0; i < 10; ++i)
915 #pragma omp simd order(reproducible:concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp simd'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
916 for (int i = 0; i < 10; ++i)
918 #pragma omp simd order(unconstrained:concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp simd'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
919 for (int i = 0; i < 10; ++i)
921 #pragma omp simd order(concurrent) order(concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp simd'}} omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp simd'}} omp51-error {{directive '#pragma omp simd' cannot contain more than one 'order' clause}}
922 for (int i = 0; i < 10; ++i)