1 // RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify=expected,omp4 %s -Wuninitialized
2 // RUN: %clang_cc1 -fsyntax-only -fopenmp -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify=expected,omp5 %s -Wuninitialized
4 // RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify=expected,omp4 %s -Wuninitialized
5 // RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify=expected,omp5 %s -Wuninitialized
13 S(const S
&s
) : a(s
.a
) {}
17 // expected-note@+1 {{defined as threadprivate or thread local}}
18 #pragma omp threadprivate(sii)
21 // Currently, we cannot use "0" for global register variables.
22 // register int reg0 __asm__("0");
25 int test_iteration_spaces() {
27 float a
[N
], b
[N
], c
[N
];
32 register int reg
; // expected-warning {{'register' storage class specifier is deprecated}}
34 #pragma omp masked taskloop simd filter(tid)
35 for (int i
= 0; i
< 10; i
+= 1) {
39 #pragma omp masked taskloop simd
40 for (char i
= 0; i
< 10; i
++) {
44 #pragma omp masked taskloop simd
45 for (char i
= 0; i
< 10; i
+= '\1') {
49 #pragma omp masked taskloop simd
50 for (long long i
= 0; i
< 10; i
++) {
54 // expected-error@+2 {{expression must have integral or unscoped enumeration type, not 'double'}}
55 #pragma omp masked taskloop simd
56 for (long long i
= 0; i
< 10; i
+= 1.5) {
60 #pragma omp masked taskloop simd
61 for (long long i
= 0; i
< 'z'; i
+= 1u) {
65 // expected-error@+2 {{variable must be of integer or random access iterator type}}
66 #pragma omp masked taskloop simd
67 for (float fi
= 0; fi
< 10.0; fi
++) {
68 c
[(int)fi
] = a
[(int)fi
] + b
[(int)fi
];
71 // expected-error@+2 {{variable must be of integer or random access iterator type}}
72 #pragma omp masked taskloop simd
73 for (double fi
= 0; fi
< 10.0; fi
++) {
74 c
[(int)fi
] = a
[(int)fi
] + b
[(int)fi
];
77 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
78 #pragma omp masked taskloop simd
79 for (int &ref
= ii
; ref
< 10; ref
++) {
82 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
83 #pragma omp masked taskloop simd
84 for (int i
; i
< 10; i
++)
88 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
89 #pragma omp masked taskloop simd
90 for (int i
= 0, j
= 0; i
< 10; ++i
)
94 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
95 #pragma omp masked taskloop simd
100 // expected-warning@+3 {{expression result unused}}
101 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
102 #pragma omp masked taskloop simd
103 for (ii
+ 1; ii
< 10; ++ii
)
107 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
108 #pragma omp masked taskloop simd
109 for (c
[ii
] = 0; ii
< 10; ++ii
)
113 // Ok to skip parenthesises.
114 #pragma omp masked taskloop simd
115 for (((ii
)) = 0; ii
< 10; ++ii
)
119 // omp4-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}} omp5-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', '>=', or '!=') of loop variable 'i'}}
120 #pragma omp masked taskloop simd
121 for (int i
= 0; i
; i
++)
125 // omp4-error@+3 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}} omp5-error@+3 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', '>=', or '!=') of loop variable 'i'}}
126 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'i'}}
127 #pragma omp masked taskloop simd
128 for (int i
= 0; jj
< kk
; ii
++)
132 // omp4-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}} omp5-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', '>=', or '!=') of loop variable 'i'}}
133 #pragma omp masked taskloop simd
134 for (int i
= 0; !!i
; i
++)
138 // omp4-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
139 #pragma omp masked taskloop simd
140 for (int i
= 0; i
!= 1; i
++)
144 // omp4-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}} omp5-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', '>=', or '!=') of loop variable 'i'}}
145 #pragma omp masked taskloop simd
146 for (int i
= 0;; i
++)
151 #pragma omp masked taskloop simd
152 for (int i
= 11; i
> 10; i
--)
157 #pragma omp masked taskloop simd
158 for (int i
= 0; i
< 10; ++i
)
163 #pragma omp masked taskloop simd
164 for (ii
= 0; ii
< 10; ++ii
)
168 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
169 #pragma omp masked taskloop simd
170 for (ii
= 0; ii
< 10; ++jj
)
174 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
175 #pragma omp masked taskloop simd
176 for (ii
= 0; ii
< 10; ++++ii
)
180 // Ok but undefined behavior (in general, cannot check that incr
181 // is really loop-invariant).
182 #pragma omp masked taskloop simd
183 for (ii
= 0; ii
< 10; ii
= ii
+ ii
)
187 // expected-error@+2 {{expression must have integral or unscoped enumeration type, not 'float'}}
188 #pragma omp masked taskloop simd
189 for (ii
= 0; ii
< 10; ii
= ii
+ 1.0f
)
193 // Ok - step was converted to integer type.
194 #pragma omp masked taskloop simd
195 for (ii
= 0; ii
< 10; ii
= ii
+ (int)1.1f
)
199 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
200 #pragma omp masked taskloop simd
201 for (ii
= 0; ii
< 10; jj
= ii
+ 2)
205 // expected-warning@+3 {{relational comparison result unused}}
206 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
207 #pragma omp masked taskloop simd
208 for (ii
= 0; ii
<10; jj
> kk
+ 2)
212 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
213 #pragma omp masked taskloop simd
214 for (ii
= 0; ii
< 10;)
218 // expected-warning@+3 {{expression result unused}}
219 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
220 #pragma omp masked taskloop simd
221 for (ii
= 0; ii
< 10; !ii
)
225 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
226 #pragma omp masked taskloop simd
227 for (ii
= 0; ii
< 10; ii
? ++ii
: ++jj
)
231 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
232 #pragma omp masked taskloop simd
233 for (ii
= 0; ii
< 10; ii
= ii
< 10)
237 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
238 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
239 #pragma omp masked taskloop simd
240 for (ii
= 0; ii
< 10; ii
= ii
+ 0)
244 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
245 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
246 #pragma omp masked taskloop simd
247 for (ii
= 0; ii
< 10; ii
= ii
+ (int)(0.8 - 0.45))
251 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
252 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
253 #pragma omp masked taskloop simd
254 for (ii
= 0; (ii
) < 10; ii
-= 25)
258 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
259 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
260 #pragma omp masked taskloop simd
261 for (ii
= 0; (ii
< 10); ii
-= 0)
265 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
266 // expected-error@+2 {{increment expression must cause 'ii' to decrease on each iteration of OpenMP for loop}}
267 #pragma omp masked taskloop simd
268 for (ii
= 0; ii
> 10; (ii
+= 0))
272 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
273 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
274 #pragma omp masked taskloop simd
275 for (ii
= 0; ii
< 10; (ii
) = (1 - 1) + (ii
))
279 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
280 // expected-error@+2 {{increment expression must cause 'ii' to decrease on each iteration of OpenMP for loop}}
281 #pragma omp masked taskloop simd
282 for ((ii
= 0); ii
> 10; (ii
-= 0))
286 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
287 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
288 #pragma omp masked taskloop simd
289 for (ii
= 0; (ii
< 10); (ii
-= 0))
293 // expected-note@+2 {{defined as firstprivate}}
294 // expected-error@+2 {{loop iteration variable in the associated loop of 'omp masked taskloop simd' directive may not be firstprivate, predetermined as linear}}
295 #pragma omp masked taskloop simd firstprivate(ii)
296 for (ii
= 0; ii
< 10; ii
++)
300 #pragma omp masked taskloop simd linear(ii)
301 for (ii
= 0; ii
< 10; ii
++)
304 // omp4-note@+3 {{defined as private}}
305 // omp4-error@+3 {{loop iteration variable in the associated loop of 'omp masked taskloop simd' directive may not be private, predetermined as linear}}
307 #pragma omp masked taskloop simd private(ii)
308 for (ii
= 0; ii
< 10; ii
++)
311 // omp4-note@+3 {{defined as lastprivate}}
312 // omp4-error@+3 {{loop iteration variable in the associated loop of 'omp masked taskloop simd' directive may not be lastprivate, predetermined as linear}}
314 #pragma omp masked taskloop simd lastprivate(ii)
315 for (ii
= 0; ii
< 10; ii
++)
320 // expected-error@+2 {{loop iteration variable in the associated loop of 'omp masked taskloop simd' directive may not be threadprivate or thread local, predetermined as linear}}
321 #pragma omp masked taskloop simd
322 for (sii
= 0; sii
< 10; sii
+= 1)
328 #pragma omp masked taskloop simd
329 for (reg0
= 0; reg0
< 10; reg0
+= 1)
335 #pragma omp masked taskloop simd
336 for (reg
= 0; reg
< 10; reg
+= 1)
342 #pragma omp masked taskloop simd
343 for (globalii
= 0; globalii
< 10; globalii
+= 1)
344 c
[globalii
] = a
[globalii
];
349 #pragma omp masked taskloop simd collapse(2)
350 for (ii
= 0; ii
< 10; ii
+= 1)
351 for (globalii
= 0; globalii
< 10; globalii
+= 1)
352 c
[globalii
] += a
[globalii
] + ii
;
356 // omp4-error@+2 {{statement after '#pragma omp masked taskloop simd' must be a for loop}}
357 #pragma omp masked taskloop simd
358 for (auto &item
: a
) {
363 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
364 // expected-error@+2 {{increment expression must cause 'i' to increase on each iteration of OpenMP for loop}}
365 #pragma omp masked taskloop simd
366 for (unsigned i
= 9; i
< 10; i
--) {
370 int(*lb
)[4] = nullptr;
372 #pragma omp masked taskloop simd
373 for (int(*p
)[4] = lb
; p
< lb
+ 8; ++p
) {
377 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
378 #pragma omp masked taskloop simd
379 for (int a
{0}; a
< 10; ++a
) {
385 // Iterators allowed in openmp for-loops.
387 struct random_access_iterator_tag
{};
388 template <class Iter
>
389 struct iterator_traits
{
390 typedef typename
Iter::difference_type difference_type
;
391 typedef typename
Iter::iterator_category iterator_category
;
393 template <class Iter
>
394 typename iterator_traits
<Iter
>::difference_type
395 distance(Iter first
, Iter last
) { return first
- last
; }
400 Iter0(const Iter0
&) {}
401 Iter0
operator++() { return *this; }
402 Iter0
operator--() { return *this; }
403 bool operator<(Iter0 a
) { return true; }
405 // expected-note@+2 {{candidate function not viable: no known conversion from 'GoodIter' to 'Iter0' for 1st argument}}
406 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'Iter0' for 1st argument}}
407 int operator-(Iter0 a
, Iter0 b
) { return 0; }
410 Iter1(float f
= 0.0f
, double d
= 0.0) {}
411 Iter1(const Iter1
&) {}
412 Iter1
operator++() { return *this; }
413 Iter1
operator--() { return *this; }
414 bool operator<(Iter1 a
) { return true; }
415 bool operator>=(Iter1 a
) { return false; }
420 GoodIter(const GoodIter
&) {}
421 GoodIter(int fst
, int snd
) {}
422 GoodIter
&operator=(const GoodIter
&that
) { return *this; }
423 GoodIter
&operator=(const Iter0
&that
) { return *this; }
424 GoodIter
&operator+=(int x
) { return *this; }
425 GoodIter
&operator-=(int x
) { return *this; }
426 explicit GoodIter(void *) {}
427 GoodIter
operator++() { return *this; }
428 GoodIter
operator--() { return *this; }
429 bool operator!() { return true; }
430 bool operator<(GoodIter a
) { return true; }
431 bool operator<=(GoodIter a
) { return true; }
432 bool operator>=(GoodIter a
) { return false; }
433 typedef int difference_type
;
434 typedef std::random_access_iterator_tag iterator_category
;
436 // expected-note@+2 {{candidate function not viable: no known conversion from 'const Iter0' to 'GoodIter' for 2nd argument}}
437 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'GoodIter' for 1st argument}}
438 int operator-(GoodIter a
, GoodIter b
) { return 0; }
439 // expected-note@+1 3 {{candidate function not viable: requires single argument 'a', but 2 arguments were provided}}
440 GoodIter
operator-(GoodIter a
) { return a
; }
441 // expected-note@+2 {{candidate function not viable: no known conversion from 'const Iter0' to 'int' for 2nd argument}}
442 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'GoodIter' for 1st argument}}
443 GoodIter
operator-(GoodIter a
, int v
) { return GoodIter(); }
444 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter0' to 'GoodIter' for 1st argument}}
445 GoodIter
operator+(GoodIter a
, int v
) { return GoodIter(); }
446 // expected-note@+2 {{candidate function not viable: no known conversion from 'GoodIter' to 'int' for 1st argument}}
447 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'int' for 1st argument}}
448 GoodIter
operator-(int v
, GoodIter a
) { return GoodIter(); }
449 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter0' to 'int' for 1st argument}}
450 GoodIter
operator+(int v
, GoodIter a
) { return GoodIter(); }
452 int test_with_random_access_iterator() {
456 #pragma omp masked taskloop simd
457 for (GoodIter I
= begin
; I
< end
; ++I
)
460 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
461 #pragma omp masked taskloop simd
462 for (GoodIter
&I
= begin
; I
< end
; ++I
)
465 #pragma omp masked taskloop simd
466 for (GoodIter I
= begin
; I
>= end
; --I
)
469 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
470 #pragma omp masked taskloop simd
471 for (GoodIter
I(begin
); I
< end
; ++I
)
474 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
475 #pragma omp masked taskloop simd
476 for (GoodIter
I(nullptr); I
< end
; ++I
)
479 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
480 #pragma omp masked taskloop simd
481 for (GoodIter
I(0); I
< end
; ++I
)
484 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
485 #pragma omp masked taskloop simd
486 for (GoodIter
I(1, 2); I
< end
; ++I
)
489 #pragma omp masked taskloop simd
490 for (begin
= GoodIter(0); begin
< end
; ++begin
)
492 // expected-error@+4 {{invalid operands to binary expression ('GoodIter' and 'const Iter0')}}
493 // expected-error@+3 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
495 #pragma omp masked taskloop simd
496 for (begin
= begin0
; begin
< end
; ++begin
)
499 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
500 #pragma omp masked taskloop simd
501 for (++begin
; begin
< end
; ++begin
)
504 #pragma omp masked taskloop simd
505 for (begin
= end
; begin
< end
; ++begin
)
508 // omp4-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'I'}} omp5-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', '>=', or '!=') of loop variable 'I'}}
509 #pragma omp masked taskloop simd
510 for (GoodIter I
= begin
; I
- I
; ++I
)
513 // omp4-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'I'}} omp5-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', '>=', or '!=') of loop variable 'I'}}
514 #pragma omp masked taskloop simd
515 for (GoodIter I
= begin
; begin
< end
; ++I
)
518 // omp4-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'I'}} omp5-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', '>=', or '!=') of loop variable 'I'}}
519 #pragma omp masked taskloop simd
520 for (GoodIter I
= begin
; !I
; ++I
)
523 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
524 // expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
525 #pragma omp masked taskloop simd
526 for (GoodIter I
= begin
; I
>= end
; I
= I
+ 1)
529 #pragma omp masked taskloop simd
530 for (GoodIter I
= begin
; I
>= end
; I
= I
- 1)
533 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'I'}}
534 #pragma omp masked taskloop simd
535 for (GoodIter I
= begin
; I
>= end
; I
= -I
)
538 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
539 // expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
540 #pragma omp masked taskloop simd
541 for (GoodIter I
= begin
; I
>= end
; I
= 2 + I
)
544 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'I'}}
545 #pragma omp masked taskloop simd
546 for (GoodIter I
= begin
; I
>= end
; I
= 2 - I
)
548 // In the following example, we cannot update the loop variable using '+='
549 // expected-error@+3 {{invalid operands to binary expression ('Iter0' and 'int')}}
551 #pragma omp masked taskloop simd
552 for (Iter0 I
= begin0
; I
< end0
; ++I
)
555 // Initializer is constructor without params.
556 // expected-error@+3 {{invalid operands to binary expression ('Iter0' and 'int')}}
557 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
558 #pragma omp masked taskloop simd
559 for (Iter0 I
; I
< end0
; ++I
)
562 // expected-error@+4 {{invalid operands to binary expression ('Iter1' and 'Iter1')}}
563 // expected-error@+3 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
565 #pragma omp masked taskloop simd
566 for (Iter1 I
= begin1
; I
< end1
; ++I
)
569 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
570 // expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
571 #pragma omp masked taskloop simd
572 for (Iter1 I
= begin1
; I
>= end1
; ++I
)
575 // expected-error@+5 {{invalid operands to binary expression ('Iter1' and 'float')}}
576 // expected-error@+4 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
577 // Initializer is constructor with all default params.
578 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
579 #pragma omp masked taskloop simd
580 for (Iter1 I
; I
< end1
; ++I
) {
585 template <typename IT
, int ST
>
588 int dotest_lt(IT begin
, IT end
) {
590 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
591 // expected-error@+2 {{increment expression must cause 'I' to increase on each iteration of OpenMP for loop}}
592 #pragma omp masked taskloop simd
593 for (IT I
= begin
; I
< end
; I
= I
+ ST
) {
597 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
598 // expected-error@+2 {{increment expression must cause 'I' to increase on each iteration of OpenMP for loop}}
599 #pragma omp masked taskloop simd
600 for (IT I
= begin
; I
<= end
; I
+= ST
) {
604 #pragma omp masked taskloop simd
605 for (IT I
= begin
; I
< end
; ++I
) {
614 template <typename IT
, int ST
= 0>
615 int dotest_gt(IT begin
, IT end
) {
617 // expected-note@+3 2 {{loop step is expected to be negative due to this condition}}
618 // expected-error@+2 2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
619 #pragma omp masked taskloop simd
620 for (IT I
= begin
; I
>= end
; I
= I
+ ST
) {
624 // expected-note@+3 2 {{loop step is expected to be negative due to this condition}}
625 // expected-error@+2 2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
626 #pragma omp masked taskloop simd
627 for (IT I
= begin
; I
>= end
; I
+= ST
) {
632 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
633 // expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
634 #pragma omp masked taskloop simd
635 for (IT I
= begin
; I
>= end
; ++I
) {
640 #pragma omp masked taskloop simd
641 for (IT I
= begin
; I
< end
; I
+= TC
<int, ST
>::step()) {
646 void test_with_template() {
648 TC
<GoodIter
, 100> t1
;
649 TC
<GoodIter
, -100> t2
;
650 t1
.dotest_lt(begin
, end
);
651 t2
.dotest_lt(begin
, end
); // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
652 dotest_gt(begin
, end
); // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
653 dotest_gt
<unsigned, 10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, 10>' requested here}}
656 void test_loop_break() {
658 float a
[N
], b
[N
], c
[N
];
660 #pragma omp masked taskloop simd
661 for (int i
= 0; i
< 10; i
++) {
663 for (int j
= 0; j
< 10; ++j
) {
665 break; // OK in nested loop
675 break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
678 break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
682 #pragma omp masked taskloop simd
683 for (int i
= 0; i
< 10; i
++) {
684 for (int j
= 0; j
< 10; j
++) {
695 void test_loop_eh() {
697 float a
[N
], b
[N
], c
[N
];
699 #pragma omp masked taskloop simd
700 for (int i
= 0; i
< 10; i
++) {
702 try { // expected-error {{'try' statement cannot be used in OpenMP simd region}}
703 for (int j
= 0; j
< 10; ++j
) {
705 throw a
[i
]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
707 throw a
[i
]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
710 throw a
[i
]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
711 return; // expected-error {{cannot return from OpenMP region}}
720 for (int j
= 0; j
< 10; j
++) {
722 throw c
[i
]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
729 #pragma omp masked taskloop simd
730 for (int i
= 0; i
< 10; ++i
) {
732 void g() { throw 0; }
737 void test_loop_firstprivate_lastprivate() {
740 #pragma omp masked taskloop simd lastprivate(s) firstprivate(s)
741 for (int i
= 0; i
< 16; ++i
)