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
];
31 register int reg
; // expected-warning {{'register' storage class specifier is deprecated}}
33 #pragma omp master taskloop
34 for (int i
= 0; i
< 10; i
+= 1) {
38 #pragma omp master taskloop
39 for (char i
= 0; i
< 10; i
++) {
43 #pragma omp master taskloop
44 for (char i
= 0; i
< 10; i
+= '\1') {
48 #pragma omp master taskloop
49 for (long long i
= 0; i
< 10; i
++) {
53 // expected-error@+2 {{expression must have integral or unscoped enumeration type, not 'double'}}
54 #pragma omp master taskloop
55 for (long long i
= 0; i
< 10; i
+= 1.5) {
59 #pragma omp master taskloop
60 for (long long i
= 0; i
< 'z'; i
+= 1u) {
64 // expected-error@+2 {{variable must be of integer or random access iterator type}}
65 #pragma omp master taskloop
66 for (float fi
= 0; fi
< 10.0; fi
++) {
67 c
[(int)fi
] = a
[(int)fi
] + b
[(int)fi
];
70 // expected-error@+2 {{variable must be of integer or random access iterator type}}
71 #pragma omp master taskloop
72 for (double fi
= 0; fi
< 10.0; fi
++) {
73 c
[(int)fi
] = a
[(int)fi
] + b
[(int)fi
];
76 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
77 #pragma omp master taskloop
78 for (int &ref
= ii
; ref
< 10; ref
++) {
81 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
82 #pragma omp master taskloop
83 for (int i
; i
< 10; i
++)
87 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
88 #pragma omp master taskloop
89 for (int i
= 0, j
= 0; i
< 10; ++i
)
93 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
94 #pragma omp master taskloop
99 // expected-warning@+3 {{expression result unused}}
100 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
101 #pragma omp master taskloop
102 for (ii
+ 1; ii
< 10; ++ii
)
106 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
107 #pragma omp master taskloop
108 for (c
[ii
] = 0; ii
< 10; ++ii
)
112 // Ok to skip parenthesises.
113 #pragma omp master taskloop
114 for (((ii
)) = 0; ii
< 10; ++ii
)
118 // 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'}}
119 #pragma omp master taskloop
120 for (int i
= 0; i
; i
++)
124 // 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'}}
125 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'i'}}
126 #pragma omp master taskloop
127 for (int i
= 0; jj
< kk
; ii
++)
131 // 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'}}
132 #pragma omp master taskloop
133 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 master taskloop
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 master taskloop
146 for (int i
= 0;; i
++)
151 #pragma omp master taskloop
152 for (int i
= 11; i
> 10; i
--)
157 #pragma omp master taskloop
158 for (int i
= 0; i
< 10; ++i
)
163 #pragma omp master taskloop
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 master taskloop
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 master taskloop
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 master taskloop
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 master taskloop
189 for (ii
= 0; ii
< 10; ii
= ii
+ 1.0f
)
193 // Ok - step was converted to integer type.
194 #pragma omp master taskloop
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 master taskloop
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 master taskloop
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 master taskloop
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 master taskloop
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 master taskloop
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 master taskloop
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 master taskloop
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 master taskloop
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 master taskloop
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 master taskloop
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 master taskloop
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 master taskloop
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 master taskloop
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 master taskloop
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 master taskloop' directive may not be firstprivate, predetermined as private}}
295 #pragma omp master taskloop firstprivate(ii)
296 for (ii
= 0; ii
< 10; ii
++)
300 // expected-error@+1 {{unexpected OpenMP clause 'linear' in directive '#pragma omp master taskloop'}}
301 #pragma omp master taskloop linear(ii)
302 for (ii
= 0; ii
< 10; ii
++)
306 #pragma omp master taskloop private(ii)
307 for (ii
= 0; ii
< 10; ii
++)
311 #pragma omp master taskloop lastprivate(ii)
312 for (ii
= 0; ii
< 10; ii
++)
317 // expected-error@+2 {{loop iteration variable in the associated loop of 'omp master taskloop' directive may not be threadprivate or thread local, predetermined as private}}
318 #pragma omp master taskloop
319 for (sii
= 0; sii
< 10; sii
+= 1)
325 #pragma omp master taskloop
326 for (reg0
= 0; reg0
< 10; reg0
+= 1)
332 #pragma omp master taskloop
333 for (reg
= 0; reg
< 10; reg
+= 1)
339 #pragma omp master taskloop
340 for (globalii
= 0; globalii
< 10; globalii
+= 1)
341 c
[globalii
] = a
[globalii
];
346 #pragma omp master taskloop collapse(2)
347 for (ii
= 0; ii
< 10; ii
+= 1)
348 for (globalii
= 0; globalii
< 10; globalii
+= 1)
349 c
[globalii
] += a
[globalii
] + ii
;
353 // omp4-error@+2 {{statement after '#pragma omp master taskloop' must be a for loop}}
354 #pragma omp master taskloop
355 for (auto &item
: a
) {
360 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
361 // expected-error@+2 {{increment expression must cause 'i' to increase on each iteration of OpenMP for loop}}
362 #pragma omp master taskloop
363 for (unsigned i
= 9; i
< 10; i
--) {
367 int(*lb
)[4] = nullptr;
369 #pragma omp master taskloop
370 for (int(*p
)[4] = lb
; p
< lb
+ 8; ++p
) {
374 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
375 #pragma omp master taskloop
376 for (int a
{0}; a
< 10; ++a
) {
382 // Iterators allowed in openmp for-loops.
384 struct random_access_iterator_tag
{};
385 template <class Iter
>
386 struct iterator_traits
{
387 typedef typename
Iter::difference_type difference_type
;
388 typedef typename
Iter::iterator_category iterator_category
;
390 template <class Iter
>
391 typename iterator_traits
<Iter
>::difference_type
392 distance(Iter first
, Iter last
) { return first
- last
; }
397 Iter0(const Iter0
&) {}
398 Iter0
operator++() { return *this; }
399 Iter0
operator--() { return *this; }
400 bool operator<(Iter0 a
) { return true; }
402 // expected-note@+2 {{candidate function not viable: no known conversion from 'GoodIter' to 'Iter0' for 1st argument}}
403 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'Iter0' for 1st argument}}
404 int operator-(Iter0 a
, Iter0 b
) { return 0; }
407 Iter1(float f
= 0.0f
, double d
= 0.0) {}
408 Iter1(const Iter1
&) {}
409 Iter1
operator++() { return *this; }
410 Iter1
operator--() { return *this; }
411 bool operator<(Iter1 a
) { return true; }
412 bool operator>=(Iter1 a
) { return false; }
417 GoodIter(const GoodIter
&) {}
418 GoodIter(int fst
, int snd
) {}
419 GoodIter
&operator=(const GoodIter
&that
) { return *this; }
420 GoodIter
&operator=(const Iter0
&that
) { return *this; }
421 GoodIter
&operator+=(int x
) { return *this; }
422 GoodIter
&operator-=(int x
) { return *this; }
423 explicit GoodIter(void *) {}
424 GoodIter
operator++() { return *this; }
425 GoodIter
operator--() { return *this; }
426 bool operator!() { return true; }
427 bool operator<(GoodIter a
) { return true; }
428 bool operator<=(GoodIter a
) { return true; }
429 bool operator>=(GoodIter a
) { return false; }
430 typedef int difference_type
;
431 typedef std::random_access_iterator_tag iterator_category
;
433 // expected-note@+2 {{candidate function not viable: no known conversion from 'const Iter0' to 'GoodIter' for 2nd argument}}
434 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'GoodIter' for 1st argument}}
435 int operator-(GoodIter a
, GoodIter b
) { return 0; }
436 // expected-note@+1 3 {{candidate function not viable: requires single argument 'a', but 2 arguments were provided}}
437 GoodIter
operator-(GoodIter a
) { return a
; }
438 // expected-note@+2 {{candidate function not viable: no known conversion from 'const Iter0' to 'int' for 2nd argument}}
439 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'GoodIter' for 1st argument}}
440 GoodIter
operator-(GoodIter a
, int v
) { return GoodIter(); }
441 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter0' to 'GoodIter' for 1st argument}}
442 GoodIter
operator+(GoodIter a
, int v
) { return GoodIter(); }
443 // expected-note@+2 {{candidate function not viable: no known conversion from 'GoodIter' to 'int' for 1st argument}}
444 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'int' for 1st argument}}
445 GoodIter
operator-(int v
, GoodIter a
) { return GoodIter(); }
446 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter0' to 'int' for 1st argument}}
447 GoodIter
operator+(int v
, GoodIter a
) { return GoodIter(); }
449 int test_with_random_access_iterator() {
453 #pragma omp master taskloop
454 for (GoodIter I
= begin
; I
< end
; ++I
)
457 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
458 #pragma omp master taskloop
459 for (GoodIter
&I
= begin
; I
< end
; ++I
)
462 #pragma omp master taskloop
463 for (GoodIter I
= begin
; I
>= end
; --I
)
466 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
467 #pragma omp master taskloop
468 for (GoodIter
I(begin
); I
< end
; ++I
)
471 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
472 #pragma omp master taskloop
473 for (GoodIter
I(nullptr); I
< end
; ++I
)
476 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
477 #pragma omp master taskloop
478 for (GoodIter
I(0); I
< end
; ++I
)
481 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
482 #pragma omp master taskloop
483 for (GoodIter
I(1, 2); I
< end
; ++I
)
486 #pragma omp master taskloop
487 for (begin
= GoodIter(0); begin
< end
; ++begin
)
489 // expected-error@+4 {{invalid operands to binary expression ('GoodIter' and 'const Iter0')}}
490 // expected-error@+3 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
492 #pragma omp master taskloop
493 for (begin
= begin0
; begin
< end
; ++begin
)
496 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
497 #pragma omp master taskloop
498 for (++begin
; begin
< end
; ++begin
)
501 #pragma omp master taskloop
502 for (begin
= end
; begin
< end
; ++begin
)
505 // 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'}}
506 #pragma omp master taskloop
507 for (GoodIter I
= begin
; I
- I
; ++I
)
510 // 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'}}
511 #pragma omp master taskloop
512 for (GoodIter I
= begin
; begin
< end
; ++I
)
515 // 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'}}
516 #pragma omp master taskloop
517 for (GoodIter I
= begin
; !I
; ++I
)
520 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
521 // expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
522 #pragma omp master taskloop
523 for (GoodIter I
= begin
; I
>= end
; I
= I
+ 1)
526 #pragma omp master taskloop
527 for (GoodIter I
= begin
; I
>= end
; I
= I
- 1)
530 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'I'}}
531 #pragma omp master taskloop
532 for (GoodIter I
= begin
; I
>= end
; I
= -I
)
535 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
536 // expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
537 #pragma omp master taskloop
538 for (GoodIter I
= begin
; I
>= end
; I
= 2 + I
)
541 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'I'}}
542 #pragma omp master taskloop
543 for (GoodIter I
= begin
; I
>= end
; I
= 2 - I
)
545 // In the following example, we cannot update the loop variable using '+='
546 // expected-error@+3 {{invalid operands to binary expression ('Iter0' and 'int')}}
548 #pragma omp master taskloop
549 for (Iter0 I
= begin0
; I
< end0
; ++I
)
552 // Initializer is constructor without params.
553 // expected-error@+3 {{invalid operands to binary expression ('Iter0' and 'int')}}
554 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
555 #pragma omp master taskloop
556 for (Iter0 I
; I
< end0
; ++I
)
559 // expected-error@+4 {{invalid operands to binary expression ('Iter1' and 'Iter1')}}
560 // expected-error@+3 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
562 #pragma omp master taskloop
563 for (Iter1 I
= begin1
; I
< end1
; ++I
)
566 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
567 // expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
568 #pragma omp master taskloop
569 for (Iter1 I
= begin1
; I
>= end1
; ++I
)
572 // expected-error@+5 {{invalid operands to binary expression ('Iter1' and 'float')}}
573 // expected-error@+4 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
574 // Initializer is constructor with all default params.
575 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
576 #pragma omp master taskloop
577 for (Iter1 I
; I
< end1
; ++I
) {
582 template <typename IT
, int ST
>
585 int dotest_lt(IT begin
, IT end
) {
587 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
588 // expected-error@+2 {{increment expression must cause 'I' to increase on each iteration of OpenMP for loop}}
589 #pragma omp master taskloop
590 for (IT I
= begin
; I
< end
; I
= I
+ ST
) {
594 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
595 // expected-error@+2 {{increment expression must cause 'I' to increase on each iteration of OpenMP for loop}}
596 #pragma omp master taskloop
597 for (IT I
= begin
; I
<= end
; I
+= ST
) {
601 #pragma omp master taskloop
602 for (IT I
= begin
; I
< end
; ++I
) {
611 template <typename IT
, int ST
= 0>
612 int dotest_gt(IT begin
, IT end
) {
614 // expected-note@+3 2 {{loop step is expected to be negative due to this condition}}
615 // expected-error@+2 2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
616 #pragma omp master taskloop
617 for (IT I
= begin
; I
>= end
; I
= I
+ ST
) {
621 // expected-note@+3 2 {{loop step is expected to be negative due to this condition}}
622 // expected-error@+2 2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
623 #pragma omp master taskloop
624 for (IT I
= begin
; I
>= end
; I
+= ST
) {
629 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
630 // expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
631 #pragma omp master taskloop
632 for (IT I
= begin
; I
>= end
; ++I
) {
637 #pragma omp master taskloop
638 for (IT I
= begin
; I
< end
; I
+= TC
<int, ST
>::step()) {
643 void test_with_template() {
645 TC
<GoodIter
, 100> t1
;
646 TC
<GoodIter
, -100> t2
;
647 t1
.dotest_lt(begin
, end
);
648 t2
.dotest_lt(begin
, end
); // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
649 dotest_gt(begin
, end
); // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
650 dotest_gt
<unsigned, 10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, 10>' requested here}}
653 void test_loop_break() {
655 float a
[N
], b
[N
], c
[N
];
657 #pragma omp master taskloop
658 for (int i
= 0; i
< 10; i
++) {
660 for (int j
= 0; j
< 10; ++j
) {
662 break; // OK in nested loop
672 break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
675 break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
679 #pragma omp master taskloop
680 for (int i
= 0; i
< 10; i
++) {
681 for (int j
= 0; j
< 10; j
++) {
692 void test_loop_eh() {
694 float a
[N
], b
[N
], c
[N
];
696 #pragma omp master taskloop
697 for (int i
= 0; i
< 10; i
++) {
700 for (int j
= 0; j
< 10; ++j
) {
708 return; // expected-error {{cannot return from OpenMP region}}
717 for (int j
= 0; j
< 10; j
++) {
726 #pragma omp master taskloop
727 for (int i
= 0; i
< 10; ++i
) {
729 void g() { throw 0; }
734 void test_loop_firstprivate_lastprivate() {
737 #pragma omp master taskloop lastprivate(s) firstprivate(s)
738 for (int i
= 0; i
< 16; ++i
)