1 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -std=c++17 -fopenmp -fsyntax-only -Wuninitialized -verify %s
4 // expected-error@+2 {{statement after '#pragma omp unroll' must be a for loop}}
8 // expected-error@+2 {{statement after '#pragma omp unroll' must be a for loop}}
12 // expected-error@+2 {{the loop condition expression depends on the current loop control variable}}
14 for (int i
= 0; i
< 2*(i
-4); ++i
) {}
16 // expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', '>=', or '!=') of loop variable 'i'}}
18 for (int i
= 0; i
/3 < 7; ++i
) {}
20 // expected-warning@+1 {{extra tokens at the end of '#pragma omp unroll' are ignored}}
21 #pragma omp unroll foo
22 for (int i
= 0; i
< n
; ++i
) {}
24 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
25 #pragma omp unroll partial(
26 for (int i
= 0; i
< n
; ++i
) {}
28 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
29 #pragma omp unroll partial(4
30 for (int i
= 0; i
< n
; ++i
) {}
32 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
33 #pragma omp unroll partial(4+
34 for (int i
= 0; i
< n
; ++i
) {}
36 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
37 #pragma omp unroll partial(for)
38 for (int i
= 0; i
< n
; ++i
) {}
40 // expected-error@+1 {{integral constant expression must have integral or unscoped enumeration type, not 'void (int)'}}
41 #pragma omp unroll partial(func)
42 for (int i
= 0; i
< n
; ++i
) {}
44 // expected-error@+1 {{expected expression}}
45 #pragma omp unroll partial()
46 for (int i
= 0; i
< n
; ++i
) {}
48 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
49 #pragma omp unroll partial(4,4)
50 for (int i
= 0; i
< n
; ++i
) {}
52 // expected-error@+3 {{expression is not an integral constant expression}} expected-note@+3 {{read of non-const variable 'a' is not allowed in a constant expression}}
53 // expected-note@+1 {{declared here}}
55 #pragma omp unroll partial(a)
56 for (int i
= 0; i
< n
; ++i
) {}
58 // expected-error@+1 {{argument to 'partial' clause must be a strictly positive integer value}}
59 #pragma omp unroll partial(0)
60 for (int i
= 0; i
< n
; ++i
) {}
62 // expected-error@+1 {{directive '#pragma omp unroll' cannot contain more than one 'partial' clause}}
63 #pragma omp unroll partial partial
64 for (int i
= 0; i
< n
; ++i
) {}
66 // expected-error@+1 {{directive '#pragma omp unroll' cannot contain more than one 'partial' clause}}
67 #pragma omp unroll partial(4) partial
68 for (int i
= 0; i
< n
; ++i
) {}
70 // expected-error@+1 {{directive '#pragma omp unroll' cannot contain more than one 'full' clause}}
71 #pragma omp unroll full full
72 for (int i
= 0; i
< 128; ++i
) {}
74 // expected-error@+1 {{'full' and 'partial' clause are mutually exclusive and may not appear on the same directive}} expected-note@+1 {{'partial' clause is specified here}}
75 #pragma omp unroll partial full
76 for (int i
= 0; i
< n
; ++i
) {}
78 // expected-error@+1 {{'partial' and 'full' clause are mutually exclusive and may not appear on the same directive}} expected-note@+1 {{'full' clause is specified here}}
79 #pragma omp unroll full partial
80 for (int i
= 0; i
< n
; ++i
) {}
82 // expected-error@+2 {{loop to be fully unrolled must have a constant trip count}} expected-note@+1 {{'#pragma omp unroll full' directive found here}}
83 #pragma omp unroll full
84 for (int i
= 0; i
< n
; ++i
) {}
86 // expected-error@+2 {{statement after '#pragma omp for' must be a for loop}}
89 for (int i
= 0; i
< n
; ++i
) {}
91 // expected-error@+2 {{statement after '#pragma omp for' must be a for loop}}
93 #pragma omp unroll full
94 for (int i
= 0; i
< 128; ++i
) {}
96 // expected-error@+2 {{statement after '#pragma omp unroll' must be a for loop}}
99 for (int i
= 0; i
< n
; ++i
) {}
101 // expected-error@+2 {{statement after '#pragma omp tile' must be a for loop}}
102 #pragma omp tile sizes(4)
104 for (int i
= 0; i
< n
; ++i
) {}
106 // expected-error@+4 {{expected 2 for loops after '#pragma omp for', but found only 1}}
107 // expected-note@+1 {{as specified in 'collapse' clause}}
108 #pragma omp for collapse(2)
109 for (int i
= 0; i
< n
; ++i
) {
110 #pragma omp unroll full
111 for (int j
= 0; j
< 128; ++j
) {}
116 template<typename T
, int Factor
>
117 void templated_func(int n
) {
118 // expected-error@+1 {{argument to 'partial' clause must be a strictly positive integer value}}
119 #pragma omp unroll partial(Factor)
120 for (T i
= 0; i
< n
; ++i
) {}
122 // expected-error@+2 {{loop to be fully unrolled must have a constant trip count}} expected-note@+1 {{'#pragma omp unroll full' directive found here}}
123 #pragma omp unroll full
124 for (int i
= 0; i
< n
; i
-=Factor
) {}
127 void template_inst(int n
) {
128 // expected-note@+1 {{in instantiation of function template specialization 'templated_func<int, -1>' requested here}}
129 templated_func
<int, -1>(n
);