1 // RUN: %clang_cc1 -fsyntax-only -fopenmp=libiomp5 -verify %s
2
3 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp simd'}}
4 #pragma omp simd
5
6 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp simd'}}
7 #pragma omp simd foo
8
9 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp simd'}}
10 #pragma omp simd safelen(4)
11
test_no_clause()12 void test_no_clause()
13 {
14 int i;
15 #pragma omp simd
16 for (i = 0; i < 16; ++i) ;
17
18 // expected-error@+2 {{statement after '#pragma omp simd' must be a for loop}}
19 #pragma omp simd
20 ++i;
21 }
22
test_branch_protected_scope()23 void test_branch_protected_scope()
24 {
25 int i = 0;
26 L1:
27 ++i;
28
29 int x[24];
30
31 #pragma omp simd
32 for (i = 0; i < 16; ++i) {
33 if (i == 5)
34 goto L1; // expected-error {{use of undeclared label 'L1'}}
35 else if (i == 6)
36 return; // expected-error {{cannot return from OpenMP region}}
37 else if (i == 7)
38 goto L2;
39 else if (i == 8) {
40 L2:
41 x[i]++;
42 }
43 }
44
45 if (x[0] == 0)
46 goto L2; // expected-error {{use of undeclared label 'L2'}}
47 else if (x[1] == 1)
48 goto L1;
49 }
50
test_invalid_clause()51 void test_invalid_clause()
52 {
53 int i;
54 // expected-warning@+1 {{extra tokens at the end of '#pragma omp simd' are ignored}}
55 #pragma omp simd foo bar
56 for (i = 0; i < 16; ++i) ;
57 }
58
test_non_identifiers()59 void test_non_identifiers()
60 {
61 int i, x;
62
63 // expected-warning@+1 {{extra tokens at the end of '#pragma omp simd' are ignored}}
64 #pragma omp simd;
65 for (i = 0; i < 16; ++i) ;
66 // expected-error@+2 {{unexpected OpenMP clause 'firstprivate' in directive '#pragma omp simd'}}
67 // expected-warning@+1 {{extra tokens at the end of '#pragma omp simd' are ignored}}
68 #pragma omp simd firstprivate(x);
69 for (i = 0; i < 16; ++i) ;
70
71 // expected-warning@+1 {{extra tokens at the end of '#pragma omp simd' are ignored}}
72 #pragma omp simd private(x);
73 for (i = 0; i < 16; ++i) ;
74
75 // expected-warning@+1 {{extra tokens at the end of '#pragma omp simd' are ignored}}
76 #pragma omp simd , private(x);
77 for (i = 0; i < 16; ++i) ;
78 }
79
80 extern int foo();
test_safelen()81 void test_safelen()
82 {
83 int i;
84 // expected-error@+1 {{expected '('}}
85 #pragma omp simd safelen
86 for (i = 0; i < 16; ++i) ;
87 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
88 #pragma omp simd safelen(
89 for (i = 0; i < 16; ++i) ;
90 // expected-error@+1 {{expected expression}}
91 #pragma omp simd safelen()
92 for (i = 0; i < 16; ++i) ;
93 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
94 #pragma omp simd safelen(,
95 for (i = 0; i < 16; ++i) ;
96 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
97 #pragma omp simd safelen(,)
98 for (i = 0; i < 16; ++i) ;
99 // expected-warning@+2 {{extra tokens at the end of '#pragma omp simd' are ignored}}
100 // expected-error@+1 {{expected '('}}
101 #pragma omp simd safelen 4)
102 for (i = 0; i < 16; ++i) ;
103 // expected-error@+2 {{expected ')'}}
104 // expected-note@+1 {{to match this '('}}
105 #pragma omp simd safelen(4
106 for (i = 0; i < 16; ++i) ;
107 // expected-error@+2 {{expected ')'}}
108 // expected-note@+1 {{to match this '('}}
109 #pragma omp simd safelen(4,
110 for (i = 0; i < 16; ++i) ;
111 // expected-error@+2 {{expected ')'}}
112 // expected-note@+1 {{to match this '('}}
113 #pragma omp simd safelen(4,)
114 for (i = 0; i < 16; ++i) ;
115 // xxpected-error@+1 {{expected expression}}
116 #pragma omp simd safelen(4)
117 for (i = 0; i < 16; ++i) ;
118 // expected-error@+2 {{expected ')'}}
119 // expected-note@+1 {{to match this '('}}
120 #pragma omp simd safelen(4 4)
121 for (i = 0; i < 16; ++i) ;
122 // expected-error@+2 {{expected ')'}}
123 // expected-note@+1 {{to match this '('}}
124 #pragma omp simd safelen(4,,4)
125 for (i = 0; i < 16; ++i) ;
126 #pragma omp simd safelen(4)
127 for (i = 0; i < 16; ++i) ;
128 // expected-error@+2 {{expected ')'}}
129 // expected-note@+1 {{to match this '('}}
130 #pragma omp simd safelen(4,8)
131 for (i = 0; i < 16; ++i) ;
132 // expected-error@+1 {{expression is not an integer constant expression}}
133 #pragma omp simd safelen(2.5)
134 for (i = 0; i < 16; ++i);
135 // expected-error@+1 {{expression is not an integer constant expression}}
136 #pragma omp simd safelen(foo())
137 for (i = 0; i < 16; ++i);
138 // expected-error@+1 {{argument to 'safelen' clause must be a positive integer value}}
139 #pragma omp simd safelen(-5)
140 for (i = 0; i < 16; ++i);
141 // expected-error@+1 {{argument to 'safelen' clause must be a positive integer value}}
142 #pragma omp simd safelen(0)
143 for (i = 0; i < 16; ++i);
144 // expected-error@+1 {{argument to 'safelen' clause must be a positive integer value}}
145 #pragma omp simd safelen(5-5)
146 for (i = 0; i < 16; ++i);
147 }
148
test_collapse()149 void test_collapse()
150 {
151 int i;
152 // expected-error@+1 {{expected '('}}
153 #pragma omp simd collapse
154 for (i = 0; i < 16; ++i) ;
155 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
156 #pragma omp simd collapse(
157 for (i = 0; i < 16; ++i) ;
158 // expected-error@+1 {{expected expression}}
159 #pragma omp simd collapse()
160 for (i = 0; i < 16; ++i) ;
161 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
162 #pragma omp simd collapse(,
163 for (i = 0; i < 16; ++i) ;
164 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
165 #pragma omp simd collapse(,)
166 for (i = 0; i < 16; ++i) ;
167 // expected-warning@+2 {{extra tokens at the end of '#pragma omp simd' are ignored}}
168 // expected-error@+1 {{expected '('}}
169 #pragma omp simd collapse 4)
170 for (i = 0; i < 16; ++i) ;
171 // expected-error@+2 {{expected ')'}}
172 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
173 #pragma omp simd collapse(4
174 for (i = 0; i < 16; ++i) ; // expected-error {{expected 4 for loops after '#pragma omp simd', but found only 1}}
175 // expected-error@+2 {{expected ')'}}
176 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
177 #pragma omp simd collapse(4,
178 for (i = 0; i < 16; ++i) ; // expected-error {{expected 4 for loops after '#pragma omp simd', but found only 1}}
179 // expected-error@+2 {{expected ')'}}
180 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
181 #pragma omp simd collapse(4,)
182 for (i = 0; i < 16; ++i) ; // expected-error {{expected 4 for loops after '#pragma omp simd', but found only 1}}
183 // xxpected-error@+1 {{expected expression}} expected-note@+1 {{as specified in 'collapse' clause}}
184 #pragma omp simd collapse(4)
185 for (i = 0; i < 16; ++i) ; // expected-error {{expected 4 for loops after '#pragma omp simd', but found only 1}}
186 // expected-error@+2 {{expected ')'}}
187 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
188 #pragma omp simd collapse(4 4)
189 for (i = 0; i < 16; ++i) ; // expected-error {{expected 4 for loops after '#pragma omp simd', but found only 1}}
190 // expected-error@+2 {{expected ')'}}
191 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
192 #pragma omp simd collapse(4,,4)
193 for (i = 0; i < 16; ++i) ; // expected-error {{expected 4 for loops after '#pragma omp simd', but found only 1}}
194 #pragma omp simd collapse(4)
195 for (int i1 = 0; i1 < 16; ++i1)
196 for (int i2 = 0; i2 < 16; ++i2)
197 for (int i3 = 0; i3 < 16; ++i3)
198 for (int i4 = 0; i4 < 16; ++i4)
199 foo();
200 // expected-error@+2 {{expected ')'}}
201 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
202 #pragma omp simd collapse(4,8)
203 for (i = 0; i < 16; ++i) ; // expected-error {{expected 4 for loops after '#pragma omp simd', but found only 1}}
204 // expected-error@+1 {{expression is not an integer constant expression}}
205 #pragma omp simd collapse(2.5)
206 for (i = 0; i < 16; ++i);
207 // expected-error@+1 {{expression is not an integer constant expression}}
208 #pragma omp simd collapse(foo())
209 for (i = 0; i < 16; ++i);
210 // expected-error@+1 {{argument to 'collapse' clause must be a positive integer value}}
211 #pragma omp simd collapse(-5)
212 for (i = 0; i < 16; ++i);
213 // expected-error@+1 {{argument to 'collapse' clause must be a positive integer value}}
214 #pragma omp simd collapse(0)
215 for (i = 0; i < 16; ++i);
216 // expected-error@+1 {{argument to 'collapse' clause must be a positive integer value}}
217 #pragma omp simd collapse(5-5)
218 for (i = 0; i < 16; ++i);
219 }
220
test_linear()221 void test_linear()
222 {
223 int i;
224 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
225 #pragma omp simd linear(
226 for (i = 0; i < 16; ++i) ;
227 // expected-error@+2 {{expected expression}}
228 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
229 #pragma omp simd linear(,
230 for (i = 0; i < 16; ++i) ;
231 // expected-error@+2 {{expected expression}}
232 // expected-error@+1 {{expected expression}}
233 #pragma omp simd linear(,)
234 for (i = 0; i < 16; ++i) ;
235 // expected-error@+1 {{expected expression}}
236 #pragma omp simd linear()
237 for (i = 0; i < 16; ++i) ;
238 // expected-error@+1 {{expected expression}}
239 #pragma omp simd linear(int)
240 for (i = 0; i < 16; ++i) ;
241 // expected-error@+1 {{expected variable name}}
242 #pragma omp simd linear(0)
243 for (i = 0; i < 16; ++i) ;
244 // expected-error@+1 {{use of undeclared identifier 'x'}}
245 #pragma omp simd linear(x)
246 for (i = 0; i < 16; ++i) ;
247 // expected-error@+2 {{use of undeclared identifier 'x'}}
248 // expected-error@+1 {{use of undeclared identifier 'y'}}
249 #pragma omp simd linear(x, y)
250 for (i = 0; i < 16; ++i) ;
251 // expected-error@+3 {{use of undeclared identifier 'x'}}
252 // expected-error@+2 {{use of undeclared identifier 'y'}}
253 // expected-error@+1 {{use of undeclared identifier 'z'}}
254 #pragma omp simd linear(x, y, z)
255 for (i = 0; i < 16; ++i) ;
256
257 int x, y;
258 // expected-error@+1 {{expected expression}}
259 #pragma omp simd linear(x:)
260 for (i = 0; i < 16; ++i) ;
261 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
262 #pragma omp simd linear(x:,)
263 for (i = 0; i < 16; ++i) ;
264 #pragma omp simd linear(x:1)
265 for (i = 0; i < 16; ++i) ;
266 #pragma omp simd linear(x:2*2)
267 for (i = 0; i < 16; ++i) ;
268 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
269 #pragma omp simd linear(x:1,y)
270 for (i = 0; i < 16; ++i) ;
271 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
272 #pragma omp simd linear(x:1,y,z:1)
273 for (i = 0; i < 16; ++i) ;
274
275 // expected-note@+2 {{defined as linear}}
276 // expected-error@+1 {{linear variable cannot be linear}}
277 #pragma omp simd linear(x) linear(x)
278 for (i = 0; i < 16; ++i) ;
279
280 // expected-note@+2 {{defined as private}}
281 // expected-error@+1 {{private variable cannot be linear}}
282 #pragma omp simd private(x) linear(x)
283 for (i = 0; i < 16; ++i) ;
284
285 // expected-note@+2 {{defined as linear}}
286 // expected-error@+1 {{linear variable cannot be private}}
287 #pragma omp simd linear(x) private(x)
288 for (i = 0; i < 16; ++i) ;
289
290 // expected-warning@+1 {{zero linear step (x and other variables in clause should probably be const)}}
291 #pragma omp simd linear(x,y:0)
292 for (i = 0; i < 16; ++i) ;
293
294 // expected-note@+2 {{defined as linear}}
295 // expected-error@+1 {{linear variable cannot be lastprivate}}
296 #pragma omp simd linear(x) lastprivate(x)
297 for (i = 0; i < 16; ++i) ;
298
299 // expected-note@+2 {{defined as lastprivate}}
300 // expected-error@+1 {{lastprivate variable cannot be linear}}
301 #pragma omp simd lastprivate(x) linear(x)
302 for (i = 0; i < 16; ++i) ;
303
304 }
305
test_aligned()306 void test_aligned()
307 {
308 int i;
309 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
310 #pragma omp simd aligned(
311 for (i = 0; i < 16; ++i) ;
312 // expected-error@+2 {{expected expression}}
313 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
314 #pragma omp simd aligned(,
315 for (i = 0; i < 16; ++i) ;
316 // expected-error@+2 {{expected expression}}
317 // expected-error@+1 {{expected expression}}
318 #pragma omp simd aligned(,)
319 for (i = 0; i < 16; ++i) ;
320 // expected-error@+1 {{expected expression}}
321 #pragma omp simd aligned()
322 for (i = 0; i < 16; ++i) ;
323 // expected-error@+1 {{expected expression}}
324 #pragma omp simd aligned(int)
325 for (i = 0; i < 16; ++i) ;
326 // expected-error@+1 {{expected variable name}}
327 #pragma omp simd aligned(0)
328 for (i = 0; i < 16; ++i) ;
329 // expected-error@+1 {{use of undeclared identifier 'x'}}
330 #pragma omp simd aligned(x)
331 for (i = 0; i < 16; ++i) ;
332 // expected-error@+2 {{use of undeclared identifier 'x'}}
333 // expected-error@+1 {{use of undeclared identifier 'y'}}
334 #pragma omp simd aligned(x, y)
335 for (i = 0; i < 16; ++i) ;
336 // expected-error@+3 {{use of undeclared identifier 'x'}}
337 // expected-error@+2 {{use of undeclared identifier 'y'}}
338 // expected-error@+1 {{use of undeclared identifier 'z'}}
339 #pragma omp simd aligned(x, y, z)
340 for (i = 0; i < 16; ++i) ;
341
342 int *x, y, z[25]; // expected-note 4 {{'y' defined here}}
343 #pragma omp simd aligned(x)
344 for (i = 0; i < 16; ++i) ;
345 #pragma omp simd aligned(z)
346 for (i = 0; i < 16; ++i) ;
347 // expected-error@+1 {{expected expression}}
348 #pragma omp simd aligned(x:)
349 for (i = 0; i < 16; ++i) ;
350 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
351 #pragma omp simd aligned(x:,)
352 for (i = 0; i < 16; ++i) ;
353 #pragma omp simd aligned(x:1)
354 for (i = 0; i < 16; ++i) ;
355 #pragma omp simd aligned(x:2*2)
356 for (i = 0; i < 16; ++i) ;
357 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
358 #pragma omp simd aligned(x:1,y)
359 for (i = 0; i < 16; ++i) ;
360 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
361 #pragma omp simd aligned(x:1,y,z:1)
362 for (i = 0; i < 16; ++i) ;
363
364 // expected-error@+1 {{argument of aligned clause should be array or pointer, not 'int'}}
365 #pragma omp simd aligned(x, y)
366 for (i = 0; i < 16; ++i) ;
367 // expected-error@+1 {{argument of aligned clause should be array or pointer, not 'int'}}
368 #pragma omp simd aligned(x, y, z)
369 for (i = 0; i < 16; ++i) ;
370
371 // expected-note@+2 {{defined as aligned}}
372 // expected-error@+1 {{a variable cannot appear in more than one aligned clause}}
373 #pragma omp simd aligned(x) aligned(z,x)
374 for (i = 0; i < 16; ++i) ;
375
376 // expected-note@+3 {{defined as aligned}}
377 // expected-error@+2 {{a variable cannot appear in more than one aligned clause}}
378 // expected-error@+1 2 {{argument of aligned clause should be array or pointer, not 'int'}}
379 #pragma omp simd aligned(x,y,z) aligned(y,z)
380 for (i = 0; i < 16; ++i) ;
381 }
382
test_private()383 void test_private()
384 {
385 int i;
386 // expected-error@+2 {{expected expression}}
387 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
388 #pragma omp simd private(
389 for (i = 0; i < 16; ++i) ;
390 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
391 // expected-error@+1 2 {{expected expression}}
392 #pragma omp simd private(,
393 for (i = 0; i < 16; ++i) ;
394 // expected-error@+1 2 {{expected expression}}
395 #pragma omp simd private(,)
396 for (i = 0; i < 16; ++i) ;
397 // expected-error@+1 {{expected expression}}
398 #pragma omp simd private()
399 for (i = 0; i < 16; ++i) ;
400 // expected-error@+1 {{expected expression}}
401 #pragma omp simd private(int)
402 for (i = 0; i < 16; ++i) ;
403 // expected-error@+1 {{expected variable name}}
404 #pragma omp simd private(0)
405 for (i = 0; i < 16; ++i) ;
406
407 int x, y, z;
408 #pragma omp simd private(x)
409 for (i = 0; i < 16; ++i) ;
410 #pragma omp simd private(x, y)
411 for (i = 0; i < 16; ++i) ;
412 #pragma omp simd private(x, y, z)
413 for (i = 0; i < 16; ++i) {
414 x = y * i + z;
415 }
416 }
417
test_firstprivate()418 void test_firstprivate()
419 {
420 int i;
421 // expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}}
422 // expected-error@+2 {{unexpected OpenMP clause 'firstprivate' in directive '#pragma omp simd'}}
423 // expected-error@+1 {{expected expression}}
424 #pragma omp simd firstprivate(
425 for (i = 0; i < 16; ++i) ;
426 }
427
test_lastprivate()428 void test_lastprivate()
429 {
430 int i;
431 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
432 // expected-error@+1 {{expected expression}}
433 #pragma omp simd lastprivate(
434 for (i = 0; i < 16; ++i) ;
435
436 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
437 // expected-error@+1 2 {{expected expression}}
438 #pragma omp simd lastprivate(,
439 for (i = 0; i < 16; ++i) ;
440 // expected-error@+1 2 {{expected expression}}
441 #pragma omp simd lastprivate(,)
442 for (i = 0; i < 16; ++i) ;
443 // expected-error@+1 {{expected expression}}
444 #pragma omp simd lastprivate()
445 for (i = 0; i < 16; ++i) ;
446 // expected-error@+1 {{expected expression}}
447 #pragma omp simd lastprivate(int)
448 for (i = 0; i < 16; ++i) ;
449 // expected-error@+1 {{expected variable name}}
450 #pragma omp simd lastprivate(0)
451 for (i = 0; i < 16; ++i) ;
452
453 int x, y, z;
454 #pragma omp simd lastprivate(x)
455 for (i = 0; i < 16; ++i) ;
456 #pragma omp simd lastprivate(x, y)
457 for (i = 0; i < 16; ++i) ;
458 #pragma omp simd lastprivate(x, y, z)
459 for (i = 0; i < 16; ++i) ;
460 }
461
test_reduction()462 void test_reduction()
463 {
464 int i, x, y;
465 // expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}}
466 // expected-error@+2 {{expected identifier}}
467 // expected-warning@+1 {{missing ':' after reduction identifier - ignoring}}
468 #pragma omp simd reduction(
469 for (i = 0; i < 16; ++i) ;
470 // expected-error@+2 {{expected identifier}}
471 // expected-warning@+1 {{missing ':' after reduction identifier - ignoring}}
472 #pragma omp simd reduction()
473 for (i = 0; i < 16; ++i) ;
474 // expected-error@+2 {{expected expression}}
475 // expected-warning@+1 {{missing ':' after reduction identifier - ignoring}}
476 #pragma omp simd reduction(x)
477 for (i = 0; i < 16; ++i) ;
478 // expected-error@+1 {{expected identifier}}
479 #pragma omp simd reduction(:x)
480 for (i = 0; i < 16; ++i) ;
481 // expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}}
482 // expected-error@+2 {{expected identifier}}
483 // expected-warning@+1 {{missing ':' after reduction identifier - ignoring}}
484 #pragma omp simd reduction(,
485 for (i = 0; i < 16; ++i) ;
486 // expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}}
487 // expected-error@+2 {{expected expression}}
488 // expected-warning@+1 {{missing ':' after reduction identifier - ignoring}}
489 #pragma omp simd reduction(+
490 for (i = 0; i < 16; ++i) ;
491
492 // expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}}
493 //
494 // expected-error@+1 {{expected expression}}
495 #pragma omp simd reduction(+:
496 for (i = 0; i < 16; ++i) ;
497 // expected-error@+1 {{expected expression}}
498 #pragma omp simd reduction(+:)
499 for (i = 0; i < 16; ++i) ;
500 // expected-error@+1 {{expected expression}}
501 #pragma omp simd reduction(+:,y)
502 for (i = 0; i < 16; ++i) ;
503 // expected-error@+1 {{expected expression}}
504 #pragma omp simd reduction(+:x,+:y)
505 for (i = 0; i < 16; ++i) ;
506 // expected-error@+2 {{expected identifier}}
507 // expected-warning@+1 {{missing ':' after reduction identifier - ignoring}}
508 #pragma omp simd reduction(%:x)
509 for (i = 0; i < 16; ++i) ;
510
511 #pragma omp simd reduction(+:x)
512 for (i = 0; i < 16; ++i) ;
513 #pragma omp simd reduction(*:x)
514 for (i = 0; i < 16; ++i) ;
515 #pragma omp simd reduction(-:x)
516 for (i = 0; i < 16; ++i) ;
517 #pragma omp simd reduction(&:x)
518 for (i = 0; i < 16; ++i) ;
519 #pragma omp simd reduction(|:x)
520 for (i = 0; i < 16; ++i) ;
521 #pragma omp simd reduction(^:x)
522 for (i = 0; i < 16; ++i) ;
523 #pragma omp simd reduction(&&:x)
524 for (i = 0; i < 16; ++i) ;
525 #pragma omp simd reduction(||:x)
526 for (i = 0; i < 16; ++i) ;
527 #pragma omp simd reduction(max:x)
528 for (i = 0; i < 16; ++i) ;
529 #pragma omp simd reduction(min:x)
530 for (i = 0; i < 16; ++i) ;
531 struct X { int x; };
532 struct X X;
533 // expected-error@+1 {{expected variable name}}
534 #pragma omp simd reduction(+:X.x)
535 for (i = 0; i < 16; ++i) ;
536 // expected-error@+1 {{expected variable name}}
537 #pragma omp simd reduction(+:x+x)
538 for (i = 0; i < 16; ++i) ;
539 }
540
test_loop_messages()541 void test_loop_messages()
542 {
543 float a[100], b[100], c[100];
544 // expected-error@+2 {{variable must be of integer or pointer type}}
545 #pragma omp simd
546 for (float fi = 0; fi < 10.0; fi++) {
547 c[(int)fi] = a[(int)fi] + b[(int)fi];
548 }
549 // expected-error@+2 {{variable must be of integer or pointer type}}
550 #pragma omp simd
551 for (double fi = 0; fi < 10.0; fi++) {
552 c[(int)fi] = a[(int)fi] + b[(int)fi];
553 }
554 }
555
556