1*73e5d7bdSFazlay Rabbi // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -ferror-limit 150 -o - %s -Wuninitialized
2*73e5d7bdSFazlay Rabbi // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
3*73e5d7bdSFazlay Rabbi // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
4*73e5d7bdSFazlay Rabbi // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -ferror-limit 150 -o - %s -Wuninitialized
5*73e5d7bdSFazlay Rabbi // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
6*73e5d7bdSFazlay Rabbi // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
7*73e5d7bdSFazlay Rabbi
8*73e5d7bdSFazlay Rabbi // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -ferror-limit 150 -o - %s -Wuninitialized
9*73e5d7bdSFazlay Rabbi // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
10*73e5d7bdSFazlay Rabbi // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
11*73e5d7bdSFazlay Rabbi // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -ferror-limit 150 -o - %s -Wuninitialized
12*73e5d7bdSFazlay Rabbi // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
13*73e5d7bdSFazlay Rabbi // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
14*73e5d7bdSFazlay Rabbi
15*73e5d7bdSFazlay Rabbi typedef void **omp_allocator_handle_t;
16*73e5d7bdSFazlay Rabbi extern const omp_allocator_handle_t omp_null_allocator;
17*73e5d7bdSFazlay Rabbi extern const omp_allocator_handle_t omp_default_mem_alloc;
18*73e5d7bdSFazlay Rabbi extern const omp_allocator_handle_t omp_large_cap_mem_alloc;
19*73e5d7bdSFazlay Rabbi extern const omp_allocator_handle_t omp_const_mem_alloc;
20*73e5d7bdSFazlay Rabbi extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
21*73e5d7bdSFazlay Rabbi extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
22*73e5d7bdSFazlay Rabbi extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
23*73e5d7bdSFazlay Rabbi extern const omp_allocator_handle_t omp_pteam_mem_alloc;
24*73e5d7bdSFazlay Rabbi extern const omp_allocator_handle_t omp_thread_mem_alloc;
25*73e5d7bdSFazlay Rabbi
xxx(int argc)26*73e5d7bdSFazlay Rabbi void xxx(int argc) {
27*73e5d7bdSFazlay Rabbi int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
28*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
29*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
30*73e5d7bdSFazlay Rabbi ;
31*73e5d7bdSFazlay Rabbi }
32*73e5d7bdSFazlay Rabbi
foo()33*73e5d7bdSFazlay Rabbi void foo() {
34*73e5d7bdSFazlay Rabbi }
35*73e5d7bdSFazlay Rabbi
foobool(int argc)36*73e5d7bdSFazlay Rabbi bool foobool(int argc) {
37*73e5d7bdSFazlay Rabbi return argc;
38*73e5d7bdSFazlay Rabbi }
39*73e5d7bdSFazlay Rabbi
foobar(int & ref)40*73e5d7bdSFazlay Rabbi void foobar(int &ref) {
41*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(+:ref)
42*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
43*73e5d7bdSFazlay Rabbi foo();
44*73e5d7bdSFazlay Rabbi }
45*73e5d7bdSFazlay Rabbi
46*73e5d7bdSFazlay Rabbi struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
47*73e5d7bdSFazlay Rabbi extern S1 a;
48*73e5d7bdSFazlay Rabbi class S2 {
49*73e5d7bdSFazlay Rabbi mutable int a;
operator +(const S2 & arg)50*73e5d7bdSFazlay Rabbi S2 &operator+(const S2 &arg) { return (*this); } // expected-note 3 {{implicitly declared private here}}
51*73e5d7bdSFazlay Rabbi
52*73e5d7bdSFazlay Rabbi public:
S2()53*73e5d7bdSFazlay Rabbi S2() : a(0) {}
S2(S2 & s2)54*73e5d7bdSFazlay Rabbi S2(S2 &s2) : a(s2.a) {}
55*73e5d7bdSFazlay Rabbi static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
56*73e5d7bdSFazlay Rabbi static const float S2sc; // expected-note 2 {{'S2sc' declared here}}
57*73e5d7bdSFazlay Rabbi };
58*73e5d7bdSFazlay Rabbi const float S2::S2sc = 0;
59*73e5d7bdSFazlay Rabbi S2 b; // expected-note 3 {{'b' defined here}}
60*73e5d7bdSFazlay Rabbi const S2 ba[5]; // expected-note 2 {{'ba' defined here}}
61*73e5d7bdSFazlay Rabbi class S3 {
62*73e5d7bdSFazlay Rabbi int a;
63*73e5d7bdSFazlay Rabbi
64*73e5d7bdSFazlay Rabbi public:
65*73e5d7bdSFazlay Rabbi int b;
S3()66*73e5d7bdSFazlay Rabbi S3() : a(0) {}
S3(const S3 & s3)67*73e5d7bdSFazlay Rabbi S3(const S3 &s3) : a(s3.a) {}
operator +(const S3 & arg1)68*73e5d7bdSFazlay Rabbi S3 operator+(const S3 &arg1) { return arg1; }
69*73e5d7bdSFazlay Rabbi };
operator +(const S3 & arg1,const S3 & arg2)70*73e5d7bdSFazlay Rabbi int operator+(const S3 &arg1, const S3 &arg2) { return 5; }
71*73e5d7bdSFazlay Rabbi S3 c; // expected-note 3 {{'c' defined here}}
72*73e5d7bdSFazlay Rabbi const S3 ca[5]; // expected-note 2 {{'ca' defined here}}
73*73e5d7bdSFazlay Rabbi extern const int f; // expected-note 4 {{'f' declared here}}
74*73e5d7bdSFazlay Rabbi class S4 {
75*73e5d7bdSFazlay Rabbi int a;
76*73e5d7bdSFazlay Rabbi S4(); // expected-note {{implicitly declared private here}}
77*73e5d7bdSFazlay Rabbi S4(const S4 &s4);
operator +(const S4 & arg)78*73e5d7bdSFazlay Rabbi S4 &operator+(const S4 &arg) { return (*this); }
79*73e5d7bdSFazlay Rabbi
80*73e5d7bdSFazlay Rabbi public:
S4(int v)81*73e5d7bdSFazlay Rabbi S4(int v) : a(v) {}
82*73e5d7bdSFazlay Rabbi };
operator &=(S4 & arg1,S4 & arg2)83*73e5d7bdSFazlay Rabbi S4 &operator&=(S4 &arg1, S4 &arg2) { return arg1; }
84*73e5d7bdSFazlay Rabbi class S5 {
85*73e5d7bdSFazlay Rabbi int a;
S5()86*73e5d7bdSFazlay Rabbi S5() : a(0) {} // expected-note {{implicitly declared private here}}
S5(const S5 & s5)87*73e5d7bdSFazlay Rabbi S5(const S5 &s5) : a(s5.a) {}
88*73e5d7bdSFazlay Rabbi S5 &operator+(const S5 &arg);
89*73e5d7bdSFazlay Rabbi
90*73e5d7bdSFazlay Rabbi public:
S5(int v)91*73e5d7bdSFazlay Rabbi S5(int v) : a(v) {}
92*73e5d7bdSFazlay Rabbi };
93*73e5d7bdSFazlay Rabbi class S6 { // expected-note 3 {{candidate function (the implicit copy assignment operator) not viable: no known conversion from 'int' to 'const S6' for 1st argument}}
94*73e5d7bdSFazlay Rabbi #if __cplusplus >= 201103L // C++11 or later
95*73e5d7bdSFazlay Rabbi // expected-note@-2 3 {{candidate function (the implicit move assignment operator) not viable}}
96*73e5d7bdSFazlay Rabbi #endif
97*73e5d7bdSFazlay Rabbi int a;
98*73e5d7bdSFazlay Rabbi
99*73e5d7bdSFazlay Rabbi public:
S6()100*73e5d7bdSFazlay Rabbi S6() : a(6) {}
operator int()101*73e5d7bdSFazlay Rabbi operator int() { return 6; }
102*73e5d7bdSFazlay Rabbi } o;
103*73e5d7bdSFazlay Rabbi
104*73e5d7bdSFazlay Rabbi struct S7 {
105*73e5d7bdSFazlay Rabbi int a: 32;
S7S7106*73e5d7bdSFazlay Rabbi S7() {
107*73e5d7bdSFazlay Rabbi #pragma omp taskloop reduction(+:a) // expected-error {{expected addressable reduction item for the task-based directives}}
108*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
109*73e5d7bdSFazlay Rabbi ++a;
110*73e5d7bdSFazlay Rabbi }
111*73e5d7bdSFazlay Rabbi };
112*73e5d7bdSFazlay Rabbi
113*73e5d7bdSFazlay Rabbi S3 h, k;
114*73e5d7bdSFazlay Rabbi #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
115*73e5d7bdSFazlay Rabbi
116*73e5d7bdSFazlay Rabbi template <class T> // expected-note {{declared here}}
tmain(T argc)117*73e5d7bdSFazlay Rabbi T tmain(T argc) {
118*73e5d7bdSFazlay Rabbi const T d = T(); // expected-note 4 {{'d' defined here}}
119*73e5d7bdSFazlay Rabbi const T da[5] = {T()}; // expected-note 2 {{'da' defined here}}
120*73e5d7bdSFazlay Rabbi T qa[5] = {T()};
121*73e5d7bdSFazlay Rabbi T i, z;
122*73e5d7bdSFazlay Rabbi T &j = i; // expected-note 4 {{'j' defined here}}
123*73e5d7bdSFazlay Rabbi S3 &p = k; // expected-note 2 {{'p' defined here}}
124*73e5d7bdSFazlay Rabbi const T &r = da[(int)i]; // expected-note 2 {{'r' defined here}}
125*73e5d7bdSFazlay Rabbi T &q = qa[(int)i]; // expected-note 2 {{'q' defined here}}
126*73e5d7bdSFazlay Rabbi T fl;
127*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction // expected-error {{expected '(' after 'reduction'}}
128*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
129*73e5d7bdSFazlay Rabbi foo();
130*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp masked taskloop simd' are ignored}}
131*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
132*73e5d7bdSFazlay Rabbi foo();
133*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
134*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
135*73e5d7bdSFazlay Rabbi foo();
136*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
137*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
138*73e5d7bdSFazlay Rabbi foo();
139*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
140*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
141*73e5d7bdSFazlay Rabbi foo();
142*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}}
143*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
144*73e5d7bdSFazlay Rabbi foo();
145*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
146*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
147*73e5d7bdSFazlay Rabbi foo();
148*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(& : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{invalid operands to binary expression ('float' and 'float')}}
149*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
150*73e5d7bdSFazlay Rabbi foo();
151*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{invalid operands to binary expression ('float' and 'float')}}
152*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
153*73e5d7bdSFazlay Rabbi foo();
154*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(|| : argc ? i : argc) // expected-error 2 {{expected variable name, array element or array section}}
155*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
156*73e5d7bdSFazlay Rabbi foo();
157*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}}
158*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
159*73e5d7bdSFazlay Rabbi foo();
160*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
161*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
162*73e5d7bdSFazlay Rabbi foo();
163*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(^ : T) // expected-error {{'T' does not refer to a value}}
164*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
165*73e5d7bdSFazlay Rabbi foo();
166*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(+ : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 3 {{const-qualified variable cannot be reduction}} expected-error 2 {{'operator+' is a private member of 'S2'}}
167*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
168*73e5d7bdSFazlay Rabbi foo();
169*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(min : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 4 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 3 {{const-qualified variable cannot be reduction}}
170*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
171*73e5d7bdSFazlay Rabbi foo();
172*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(max : h.b) // expected-error {{expected variable name, array element or array section}}
173*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
174*73e5d7bdSFazlay Rabbi foo();
175*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(+ : ba) // expected-error {{const-qualified variable cannot be reduction}}
176*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
177*73e5d7bdSFazlay Rabbi foo();
178*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(* : z, ca) // expected-error {{const-qualified variable cannot be reduction}}
179*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
180*73e5d7bdSFazlay Rabbi foo();
181*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(- : da) // expected-error {{const-qualified variable cannot be reduction}} expected-error {{const-qualified variable cannot be reduction}}
182*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
183*73e5d7bdSFazlay Rabbi foo();
184*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
185*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
186*73e5d7bdSFazlay Rabbi foo();
187*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
188*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
189*73e5d7bdSFazlay Rabbi foo();
190*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
191*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
192*73e5d7bdSFazlay Rabbi foo();
193*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}}
194*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
195*73e5d7bdSFazlay Rabbi foo();
196*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(+ : o) // expected-error 2 {{no viable overloaded '='}}
197*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
198*73e5d7bdSFazlay Rabbi foo();
199*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd private(i), reduction(+ : j), reduction(+ : q) // expected-error 4 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
200*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
201*73e5d7bdSFazlay Rabbi foo();
202*73e5d7bdSFazlay Rabbi #pragma omp parallel private(k)
203*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
204*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
205*73e5d7bdSFazlay Rabbi foo();
206*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(+ : p), reduction(+ : p) // expected-error 2 {{variable can appear only once in OpenMP 'reduction' clause}} expected-note 2 {{previously referenced here}}
207*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
208*73e5d7bdSFazlay Rabbi foo();
209*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(+ : r) // expected-error 2 {{const-qualified variable cannot be reduction}}
210*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
211*73e5d7bdSFazlay Rabbi foo();
212*73e5d7bdSFazlay Rabbi #pragma omp parallel shared(i)
213*73e5d7bdSFazlay Rabbi #pragma omp parallel reduction(min : i)
214*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(max : j) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
215*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
216*73e5d7bdSFazlay Rabbi foo();
217*73e5d7bdSFazlay Rabbi #pragma omp parallel private(fl)
218*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'masked taskloop simd' directive}}
219*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
220*73e5d7bdSFazlay Rabbi foo();
221*73e5d7bdSFazlay Rabbi #pragma omp parallel reduction(* : fl)
222*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(+ : fl)
223*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
224*73e5d7bdSFazlay Rabbi foo();
225*73e5d7bdSFazlay Rabbi
226*73e5d7bdSFazlay Rabbi return T();
227*73e5d7bdSFazlay Rabbi }
228*73e5d7bdSFazlay Rabbi
229*73e5d7bdSFazlay Rabbi namespace A {
230*73e5d7bdSFazlay Rabbi double x;
231*73e5d7bdSFazlay Rabbi #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
232*73e5d7bdSFazlay Rabbi }
233*73e5d7bdSFazlay Rabbi namespace B {
234*73e5d7bdSFazlay Rabbi using A::x;
235*73e5d7bdSFazlay Rabbi }
236*73e5d7bdSFazlay Rabbi
main(int argc,char ** argv)237*73e5d7bdSFazlay Rabbi int main(int argc, char **argv) {
238*73e5d7bdSFazlay Rabbi const int d = 5; // expected-note 2 {{'d' defined here}}
239*73e5d7bdSFazlay Rabbi const int da[5] = {0}; // expected-note {{'da' defined here}}
240*73e5d7bdSFazlay Rabbi int qa[5] = {0};
241*73e5d7bdSFazlay Rabbi S4 e(4);
242*73e5d7bdSFazlay Rabbi S5 g(5);
243*73e5d7bdSFazlay Rabbi int i, z;
244*73e5d7bdSFazlay Rabbi int &j = i; // expected-note 2 {{'j' defined here}}
245*73e5d7bdSFazlay Rabbi S3 &p = k; // expected-note 2 {{'p' defined here}}
246*73e5d7bdSFazlay Rabbi const int &r = da[i]; // expected-note {{'r' defined here}}
247*73e5d7bdSFazlay Rabbi int &q = qa[i]; // expected-note {{'q' defined here}}
248*73e5d7bdSFazlay Rabbi float fl;
249*73e5d7bdSFazlay Rabbi int tid = 0;
250*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction filter(tid) // expected-error {{expected '(' after 'reduction'}}
251*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
252*73e5d7bdSFazlay Rabbi foo();
253*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp masked taskloop simd' are ignored}}
254*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
255*73e5d7bdSFazlay Rabbi foo();
256*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
257*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
258*73e5d7bdSFazlay Rabbi foo();
259*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
260*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
261*73e5d7bdSFazlay Rabbi foo();
262*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
263*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
264*73e5d7bdSFazlay Rabbi foo();
265*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}}
266*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
267*73e5d7bdSFazlay Rabbi foo();
268*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
269*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
270*73e5d7bdSFazlay Rabbi foo();
271*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(foo : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max'}}
272*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
273*73e5d7bdSFazlay Rabbi foo();
274*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
275*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
276*73e5d7bdSFazlay Rabbi foo();
277*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(|| : argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name, array element or array section}}
278*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
279*73e5d7bdSFazlay Rabbi foo();
280*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(~ : argc) // expected-error {{expected unqualified-id}}
281*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
282*73e5d7bdSFazlay Rabbi foo();
283*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(&& : argc, z)
284*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
285*73e5d7bdSFazlay Rabbi foo();
286*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(^ : S1) // expected-error {{'S1' does not refer to a value}}
287*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
288*73e5d7bdSFazlay Rabbi foo();
289*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(+ : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{const-qualified variable cannot be reduction}} expected-error {{'operator+' is a private member of 'S2'}}
290*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
291*73e5d7bdSFazlay Rabbi foo();
292*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(min : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 2 {{const-qualified variable cannot be reduction}}
293*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
294*73e5d7bdSFazlay Rabbi foo();
295*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(max : h.b) // expected-error {{expected variable name, array element or array section}}
296*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
297*73e5d7bdSFazlay Rabbi foo();
298*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(+ : ba) // expected-error {{const-qualified variable cannot be reduction}}
299*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
300*73e5d7bdSFazlay Rabbi foo();
301*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(* : ca) // expected-error {{const-qualified variable cannot be reduction}}
302*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
303*73e5d7bdSFazlay Rabbi foo();
304*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(- : da) // expected-error {{const-qualified variable cannot be reduction}}
305*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
306*73e5d7bdSFazlay Rabbi foo();
307*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
308*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
309*73e5d7bdSFazlay Rabbi foo();
310*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
311*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
312*73e5d7bdSFazlay Rabbi foo();
313*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
314*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
315*73e5d7bdSFazlay Rabbi foo();
316*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(& : e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} expected-error {{invalid operands to binary expression ('S5' and 'S5')}}
317*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
318*73e5d7bdSFazlay Rabbi foo();
319*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}}
320*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
321*73e5d7bdSFazlay Rabbi foo();
322*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(+ : o) // expected-error {{no viable overloaded '='}}
323*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
324*73e5d7bdSFazlay Rabbi foo();
325*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd private(i), reduction(+ : j), reduction(+ : q) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
326*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
327*73e5d7bdSFazlay Rabbi foo();
328*73e5d7bdSFazlay Rabbi #pragma omp parallel private(k)
329*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
330*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
331*73e5d7bdSFazlay Rabbi foo();
332*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(+ : p), reduction(+ : p) // expected-error {{variable can appear only once in OpenMP 'reduction' clause}} expected-note {{previously referenced here}}
333*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
334*73e5d7bdSFazlay Rabbi foo();
335*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(+ : r) // expected-error {{const-qualified variable cannot be reduction}}
336*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
337*73e5d7bdSFazlay Rabbi foo();
338*73e5d7bdSFazlay Rabbi #pragma omp parallel shared(i)
339*73e5d7bdSFazlay Rabbi #pragma omp parallel reduction(min : i)
340*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(max : j) // expected-error {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
341*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
342*73e5d7bdSFazlay Rabbi foo();
343*73e5d7bdSFazlay Rabbi #pragma omp parallel private(fl)
344*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(+ : fl)
345*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
346*73e5d7bdSFazlay Rabbi foo();
347*73e5d7bdSFazlay Rabbi #pragma omp parallel reduction(* : fl)
348*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(+ : fl)
349*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
350*73e5d7bdSFazlay Rabbi foo();
351*73e5d7bdSFazlay Rabbi static int m;
352*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(+ : m) // OK
353*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
354*73e5d7bdSFazlay Rabbi m++;
355*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(+ : m) nogroup // expected-error {{'reduction' clause cannot be used with 'nogroup' clause}}
356*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
357*73e5d7bdSFazlay Rabbi m++;
358*73e5d7bdSFazlay Rabbi #pragma omp masked taskloop simd reduction(task, + : m) // omp45-error 2 {{expected expression}} omp45-warning {{missing ':' after reduction identifier - ignoring}} omp50-error {{'reduction' clause with 'task' modifier allowed only on non-simd parallel or worksharing constructs}}
359*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i)
360*73e5d7bdSFazlay Rabbi m++;
361*73e5d7bdSFazlay Rabbi
362*73e5d7bdSFazlay Rabbi return tmain(argc) + tmain(fl); // expected-note {{in instantiation of function template specialization 'tmain<int>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<float>' requested here}}
363*73e5d7bdSFazlay Rabbi }
364