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 S5
&operator=(S5
&s
) {
16 #pragma omp distribute simd
17 for (int k
= 0; k
< s
.a
; ++k
) // expected-warning {{Type 'S5' is not trivially copyable and not guaranteed to be mapped correctly}}
24 // expected-note@+1 {{defined as threadprivate or thread local}}
25 #pragma omp threadprivate(sii)
28 int test_iteration_spaces() {
30 float a
[N
], b
[N
], c
[N
];
36 #pragma omp distribute simd
37 for (int i
= 0; i
< 10; i
+=1) {
42 #pragma omp distribute simd
43 for (char i
= 0; i
< 10; i
++) {
48 #pragma omp distribute simd
49 for (char i
= 0; i
< 10; i
+='\1') {
54 #pragma omp distribute simd
55 for (long long i
= 0; i
< 10; i
++) {
60 // expected-error@+2 {{expression must have integral or unscoped enumeration type, not 'double'}}
61 #pragma omp distribute simd
62 for (long long i
= 0; i
< 10; i
+=1.5) {
67 #pragma omp distribute simd
68 for (long long i
= 0; i
< 'z'; i
+=1u) {
73 // expected-error@+2 {{variable must be of integer or random access iterator type}}
74 #pragma omp distribute simd
75 for (float fi
= 0; fi
< 10.0; fi
++) {
76 c
[(int)fi
] = a
[(int)fi
] + b
[(int)fi
];
80 // expected-error@+2 {{variable must be of integer or random access iterator type}}
81 #pragma omp distribute simd
82 for (double fi
= 0; fi
< 10.0; fi
++) {
83 c
[(int)fi
] = a
[(int)fi
] + b
[(int)fi
];
87 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
88 #pragma omp distribute simd
89 for (int &ref
= ii
; ref
< 10; ref
++) {
93 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
94 #pragma omp distribute simd
95 for (int i
; i
< 10; i
++)
100 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
101 #pragma omp distribute simd
102 for (int i
= 0, j
= 0; i
< 10; ++i
)
107 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
108 #pragma omp distribute simd
114 // expected-warning@+3 {{expression result unused}}
115 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
116 #pragma omp distribute simd
117 for (ii
+ 1;ii
< 10; ++ii
)
122 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
123 #pragma omp distribute simd
124 for (c
[ii
] = 0;ii
< 10; ++ii
)
127 // Ok to skip parenthesises.
130 #pragma omp distribute simd
131 for (((ii
)) = 0;ii
< 10; ++ii
)
136 // 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'}}
137 #pragma omp distribute simd
138 for (int i
= 0; i
; i
++)
143 // 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'}}
144 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'i'}}
145 #pragma omp distribute simd
146 for (int i
= 0; jj
< kk
; ii
++)
151 // 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'}}
152 #pragma omp distribute simd
153 for (int i
= 0; !!i
; i
++)
158 // omp4-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
159 #pragma omp distribute simd
160 for (int i
= 0; i
!= 1; i
++)
165 // 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'}}
166 #pragma omp distribute simd
167 for (int i
= 0; ; i
++)
173 #pragma omp distribute simd
174 for (int i
= 11; i
> 10; i
--)
180 #pragma omp distribute simd
181 for (int i
= 0; i
< 10; ++i
)
187 #pragma omp distribute simd
188 for (ii
= 0; ii
< 10; ++ii
)
193 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
194 #pragma omp distribute simd
195 for (ii
= 0; ii
< 10; ++jj
)
200 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
201 #pragma omp distribute simd
202 for (ii
= 0; ii
< 10; ++ ++ ii
)
205 // Ok but undefined behavior (in general, cannot check that incr
206 // is really loop-invariant).
209 #pragma omp distribute simd
210 for (ii
= 0; ii
< 10; ii
= ii
+ ii
)
215 // expected-error@+2 {{expression must have integral or unscoped enumeration type, not 'float'}}
216 #pragma omp distribute simd
217 for (ii
= 0; ii
< 10; ii
= ii
+ 1.0f
)
220 // Ok - step was converted to integer type.
223 #pragma omp distribute simd
224 for (ii
= 0; ii
< 10; ii
= ii
+ (int)1.1f
)
229 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
230 #pragma omp distribute simd
231 for (ii
= 0; ii
< 10; jj
= ii
+ 2)
236 // expected-warning@+3 {{relational comparison result unused}}
237 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
238 #pragma omp distribute simd
239 for (ii
= 0; ii
< 10; jj
> kk
+ 2)
244 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
245 #pragma omp distribute simd
246 for (ii
= 0; ii
< 10;)
251 // expected-warning@+3 {{expression result unused}}
252 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
253 #pragma omp distribute simd
254 for (ii
= 0; ii
< 10; !ii
)
259 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
260 #pragma omp distribute simd
261 for (ii
= 0; ii
< 10; ii
? ++ii
: ++jj
)
266 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
267 #pragma omp distribute simd
268 for (ii
= 0; ii
< 10; ii
= ii
< 10)
273 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
274 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
275 #pragma omp distribute simd
276 for (ii
= 0; ii
< 10; ii
= ii
+ 0)
281 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
282 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
283 #pragma omp distribute simd
284 for (ii
= 0; ii
< 10; ii
= ii
+ (int)(0.8 - 0.45))
289 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
290 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
291 #pragma omp distribute simd
292 for (ii
= 0; (ii
) < 10; ii
-=25)
297 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
298 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
299 #pragma omp distribute simd
300 for (ii
= 0; (ii
< 10); ii
-=0)
305 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
306 // expected-error@+2 {{increment expression must cause 'ii' to decrease on each iteration of OpenMP for loop}}
307 #pragma omp distribute simd
308 for (ii
= 0; ii
> 10; (ii
+=0))
313 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
314 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
315 #pragma omp distribute simd
316 for (ii
= 0; ii
< 10; (ii
) = (1-1)+(ii
))
321 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
322 // expected-error@+2 {{increment expression must cause 'ii' to decrease on each iteration of OpenMP for loop}}
323 #pragma omp distribute simd
324 for ((ii
= 0); ii
> 10; (ii
-=0))
329 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
330 // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
331 #pragma omp distribute simd
332 for (ii
= 0; (ii
< 10); (ii
-=0))
337 // omp4-note@+2 {{defined as private}}
338 // omp4-error@+2 {{loop iteration variable in the associated loop of 'omp distribute simd' directive may not be private, predetermined as linear}}
339 #pragma omp distribute simd private(ii)
340 for (ii
= 0; ii
< 10; ii
++)
345 // expected-error@+1 {{unexpected OpenMP clause 'shared' in directive '#pragma omp distribute simd'}}
346 #pragma omp distribute simd shared(ii)
347 for (ii
= 0; ii
< 10; ii
++)
352 #pragma omp distribute simd linear(ii)
353 for (ii
= 0; ii
< 10; ii
++)
358 #pragma omp distribute simd lastprivate(ii) linear(jj) collapse(2) // expected-note {{defined as linear}}
359 for (ii
= 0; ii
< 10; ii
++)
360 for (jj
= 0; jj
< 10; jj
++) // expected-error {{loop iteration variable in the associated loop of 'omp distribute simd' directive may not be linear, predetermined as lastprivate}}
368 // expected-error@+2 {{loop iteration variable in the associated loop of 'omp distribute simd' directive may not be threadprivate or thread local, predetermined as linear}}
369 #pragma omp distribute simd
370 for (sii
= 0; sii
< 10; sii
+=1)
378 #pragma omp distribute simd
379 for (globalii
= 0; globalii
< 10; globalii
+=1)
380 c
[globalii
] = a
[globalii
];
387 #pragma omp distribute simd collapse(2)
388 for (ii
= 0; ii
< 10; ii
+= 1)
389 for (globalii
= 0; globalii
< 10; globalii
+= 1)
390 c
[globalii
] += a
[globalii
] + ii
;
395 // omp4-error@+2 {{statement after '#pragma omp distribute simd' must be a for loop}}
396 #pragma omp distribute simd
397 for (auto &item
: a
) {
403 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
404 // expected-error@+2 {{increment expression must cause 'i' to increase on each iteration of OpenMP for loop}}
405 #pragma omp distribute simd
406 for (unsigned i
= 9; i
< 10; i
--) {
410 int (*lb
)[4] = nullptr;
413 #pragma omp distribute simd
414 for (int (*p
)[4] = lb
; p
< lb
+ 8; ++p
) {
419 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
420 #pragma omp distribute simd
421 for (int a
{0}; a
<10; ++a
) {
427 // Iterators allowed in openmp for-loops.
429 struct random_access_iterator_tag
{ };
430 template <class Iter
> struct iterator_traits
{
431 typedef typename
Iter::difference_type difference_type
;
432 typedef typename
Iter::iterator_category iterator_category
;
434 template <class Iter
>
435 typename iterator_traits
<Iter
>::difference_type
436 distance(Iter first
, Iter last
) { return first
- last
; }
441 Iter0(const Iter0
&) { }
442 Iter0
operator ++() { return *this; }
443 Iter0
operator --() { return *this; }
444 Iter0
operator + (int delta
) { return *this; }
445 bool operator <(Iter0 a
) { return true; }
447 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'Iter0' for 1st argument}}
448 int operator -(Iter0 a
, Iter0 b
) { return 0; }
451 Iter1(float f
=0.0f
, double d
=0.0) { }
452 Iter1(const Iter1
&) { }
453 Iter1
operator ++() { return *this; }
454 Iter1
operator --() { return *this; }
455 bool operator <(Iter1 a
) { return true; }
456 bool operator >=(Iter1 a
) { return false; }
461 GoodIter(const GoodIter
&) { }
462 GoodIter(int fst
, int snd
) { }
463 GoodIter
&operator =(const GoodIter
&that
) { return *this; }
464 GoodIter
&operator =(const Iter0
&that
) { return *this; }
465 GoodIter
&operator +=(int x
) { return *this; }
466 explicit GoodIter(void *) { }
467 GoodIter
operator ++() { return *this; }
468 GoodIter
operator --() { return *this; }
469 bool operator !() { return true; }
470 bool operator <(GoodIter a
) { return true; }
471 bool operator <=(GoodIter a
) { return true; }
472 bool operator >=(GoodIter a
) { return false; }
473 typedef int difference_type
;
474 typedef std::random_access_iterator_tag iterator_category
;
476 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'GoodIter' for 1st argument}}
477 int operator -(GoodIter a
, GoodIter b
) { return 0; }
478 // expected-note@+1 2 {{candidate function not viable: requires single argument 'a', but 2 arguments were provided}}
479 GoodIter
operator -(GoodIter a
) { return a
; }
480 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'GoodIter' for 1st argument}}
481 GoodIter
operator -(GoodIter a
, int v
) { return GoodIter(); }
482 GoodIter
operator +(GoodIter a
, int v
) { return GoodIter(); }
483 // expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'int' for 1st argument}}
484 GoodIter
operator -(int v
, GoodIter a
) { return GoodIter(); }
485 GoodIter
operator +(int v
, GoodIter a
) { return GoodIter(); }
487 int test_with_random_access_iterator() {
492 #pragma omp distribute simd
493 for (GoodIter I
= begin
; I
< end
; ++I
) // expected-warning 2 {{Type 'GoodIter' is not trivially copyable and not guaranteed to be mapped correctly}}
497 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
498 #pragma omp distribute simd
499 for (GoodIter
&I
= begin
; I
< end
; ++I
)
503 #pragma omp distribute simd
504 for (GoodIter I
= begin
; I
>= end
; --I
) // expected-warning 2 {{Type 'GoodIter' is not trivially copyable and not guaranteed to be mapped correctly}}
508 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
509 #pragma omp distribute simd
510 for (GoodIter
I(begin
); I
< end
; ++I
) // expected-warning 2 {{Type 'GoodIter' is not trivially copyable and not guaranteed to be mapped correctly}}
514 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
515 #pragma omp distribute simd
516 for (GoodIter
I(nullptr); I
< end
; ++I
) // expected-warning {{Type 'GoodIter' is not trivially copyable and not guaranteed to be mapped correctly}}
520 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
521 #pragma omp distribute simd
522 for (GoodIter
I(0); I
< end
; ++I
) // expected-warning {{Type 'GoodIter' is not trivially copyable and not guaranteed to be mapped correctly}}
526 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
527 #pragma omp distribute simd
528 for (GoodIter
I(1,2); I
< end
; ++I
) // expected-warning {{Type 'GoodIter' is not trivially copyable and not guaranteed to be mapped correctly}}
532 #pragma omp distribute simd
533 for (begin
= GoodIter(0); begin
< end
; ++begin
) // expected-warning 2 {{Type 'GoodIter' is not trivially copyable and not guaranteed to be mapped correctly}}
537 #pragma omp distribute simd
538 for (begin
= GoodIter(1,2); begin
< end
; ++begin
) // expected-warning 2 {{Type 'GoodIter' is not trivially copyable and not guaranteed to be mapped correctly}}
542 // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
543 #pragma omp distribute simd
544 for (++begin
; begin
< end
; ++begin
)
548 #pragma omp distribute simd
549 for (begin
= end
; begin
< end
; ++begin
) // expected-warning 2 {{Type 'GoodIter' is not trivially copyable and not guaranteed to be mapped correctly}}
553 // 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'}}
554 #pragma omp distribute simd
555 for (GoodIter I
= begin
; I
- I
; ++I
)
559 // 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'}}
560 #pragma omp distribute simd
561 for (GoodIter I
= begin
; begin
< end
; ++I
)
565 // 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'}}
566 #pragma omp distribute simd
567 for (GoodIter I
= begin
; !I
; ++I
)
571 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
572 // expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
573 #pragma omp distribute simd
574 for (GoodIter I
= begin
; I
>= end
; I
= I
+ 1)
578 #pragma omp distribute simd
579 for (GoodIter I
= begin
; I
>= end
; I
= I
- 1) // expected-warning 2 {{Type 'GoodIter' is not trivially copyable and not guaranteed to be mapped correctly}}
583 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'I'}}
584 #pragma omp distribute simd
585 for (GoodIter I
= begin
; I
>= end
; I
= -I
)
589 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
590 // expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
591 #pragma omp distribute simd
592 for (GoodIter I
= begin
; I
>= end
; I
= 2 + I
)
596 // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'I'}}
597 #pragma omp distribute simd
598 for (GoodIter I
= begin
; I
>= end
; I
= 2 - I
)
602 #pragma omp distribute simd
603 for (Iter0 I
= begin0
; I
< end0
; ++I
) // expected-warning 2 {{Type 'Iter0' is not trivially copyable and not guaranteed to be mapped correctly}}
608 // Initializer is constructor without params.
609 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
610 #pragma omp distribute simd
611 for (Iter0 I
; I
< end0
; ++I
) // expected-warning {{Type 'Iter0' is not trivially copyable and not guaranteed to be mapped correctly}}
617 // expected-error@+3 {{invalid operands to binary expression ('Iter1' and 'Iter1')}}
618 // expected-error@+2 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
619 #pragma omp distribute simd
620 for (Iter1 I
= begin1
; I
< end1
; ++I
)
624 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
625 // expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
626 #pragma omp distribute simd
627 for (Iter1 I
= begin1
; I
>= end1
; ++I
)
630 // Initializer is constructor with all default params.
633 // expected-error@+4 {{invalid operands to binary expression ('Iter1' and 'float')}}
634 // expected-error@+3 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}}
635 // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
636 #pragma omp distribute simd
637 for (Iter1 I
; I
< end1
; ++I
) {
643 template <typename IT
, int ST
> class TC
{
645 int dotest_lt(IT begin
, IT end
) {
646 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
647 // expected-error@+2 {{increment expression must cause 'I' to increase on each iteration of OpenMP for loop}}
648 #pragma omp distribute simd
649 for (IT I
= begin
; I
< end
; I
= I
+ ST
) {
654 // expected-note@+3 {{loop step is expected to be positive due to this condition}}
655 // expected-error@+2 {{increment expression must cause 'I' to increase on each iteration of OpenMP for loop}}
656 #pragma omp distribute simd
657 for (IT I
= begin
; I
<= end
; I
+= ST
) { // expected-warning 2 {{Type 'GoodIter' is not trivially copyable and not guaranteed to be mapped correctly}}
660 #pragma omp distribute simd
661 for (IT I
= begin
; I
< end
; ++I
) {
670 template <typename IT
, int ST
=0> int dotest_gt(IT begin
, IT end
) {
673 // expected-note@+3 2 {{loop step is expected to be negative due to this condition}}
674 // expected-error@+2 2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
675 #pragma omp distribute simd
676 for (IT I
= begin
; I
>= end
; I
= I
+ ST
) {
681 // expected-note@+3 2 {{loop step is expected to be negative due to this condition}}
682 // expected-error@+2 2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
683 #pragma omp distribute simd
684 for (IT I
= begin
; I
>= end
; I
+= ST
) {
690 // expected-note@+3 {{loop step is expected to be negative due to this condition}}
691 // expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
692 #pragma omp distribute simd
693 for (IT I
= begin
; I
>= end
; ++I
) {
699 #pragma omp distribute simd
700 for (IT I
= begin
; I
< end
; I
+=TC
<int,ST
>::step()) { // expected-warning 2 {{Type 'GoodIter' is not trivially copyable and not guaranteed to be mapped correctly}}
705 void test_with_template() {
707 TC
<GoodIter
, 100> t1
;
708 TC
<GoodIter
, -100> t2
;
709 t1
.dotest_lt(begin
, end
); // expected-note {{in instantiation of member function 'TC<GoodIter, 100>::dotest_lt' requested here}}
710 t2
.dotest_lt(begin
, end
); // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
711 dotest_gt(begin
, end
); // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
712 dotest_gt
<unsigned, 10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, 10>' requested here}}
715 void test_loop_break() {
717 float a
[N
], b
[N
], c
[N
];
720 #pragma omp distribute simd
721 for (int i
= 0; i
< 10; i
++) {
723 for (int j
= 0; j
< 10; ++j
) {
725 break; // OK in nested loop
735 break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
738 break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
743 #pragma omp distribute simd
744 for (int i
= 0; i
< 10; i
++) {
745 for (int j
= 0; j
< 10; j
++) {
756 void test_loop_eh() {
758 float a
[N
], b
[N
], c
[N
];
761 #pragma omp distribute simd
762 for (int i
= 0; i
< 10; i
++) {
764 try { // expected-error {{'try' statement cannot be used in OpenMP simd region}}
765 for (int j
= 0; j
< 10; ++j
) {
767 throw a
[i
]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
769 throw a
[i
]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
773 throw a
[i
]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
774 return; // expected-error {{cannot return from OpenMP region}}
783 for (int j
= 0; j
< 10; j
++) {
785 throw c
[i
]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
793 #pragma omp distribute simd
794 for (int i
= 0; i
< 10; ++i
) {
796 void g() { throw 0; }