1*38bcd483SFazlay Rabbi // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
2*38bcd483SFazlay Rabbi
3*38bcd483SFazlay Rabbi // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
4*38bcd483SFazlay Rabbi
5*38bcd483SFazlay Rabbi typedef void **omp_allocator_handle_t;
6*38bcd483SFazlay Rabbi extern const omp_allocator_handle_t omp_null_allocator;
7*38bcd483SFazlay Rabbi extern const omp_allocator_handle_t omp_default_mem_alloc;
8*38bcd483SFazlay Rabbi extern const omp_allocator_handle_t omp_large_cap_mem_alloc;
9*38bcd483SFazlay Rabbi extern const omp_allocator_handle_t omp_const_mem_alloc;
10*38bcd483SFazlay Rabbi extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
11*38bcd483SFazlay Rabbi extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
12*38bcd483SFazlay Rabbi extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
13*38bcd483SFazlay Rabbi extern const omp_allocator_handle_t omp_pteam_mem_alloc;
14*38bcd483SFazlay Rabbi extern const omp_allocator_handle_t omp_thread_mem_alloc;
15*38bcd483SFazlay Rabbi
foo()16*38bcd483SFazlay Rabbi void foo() {
17*38bcd483SFazlay Rabbi }
18*38bcd483SFazlay Rabbi
foobool(int argc)19*38bcd483SFazlay Rabbi bool foobool(int argc) {
20*38bcd483SFazlay Rabbi return argc;
21*38bcd483SFazlay Rabbi }
22*38bcd483SFazlay Rabbi
xxx(int argc)23*38bcd483SFazlay Rabbi void xxx(int argc) {
24*38bcd483SFazlay Rabbi int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
25*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
26*38bcd483SFazlay Rabbi for (int i = 0; i < 10; ++i)
27*38bcd483SFazlay Rabbi ;
28*38bcd483SFazlay Rabbi }
29*38bcd483SFazlay Rabbi
30*38bcd483SFazlay Rabbi struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
31*38bcd483SFazlay Rabbi extern S1 a;
32*38bcd483SFazlay Rabbi class S2 {
33*38bcd483SFazlay Rabbi mutable int a;
34*38bcd483SFazlay Rabbi
35*38bcd483SFazlay Rabbi public:
S2()36*38bcd483SFazlay Rabbi S2() : a(0) {}
S2(const S2 & s2)37*38bcd483SFazlay Rabbi S2(const S2 &s2) : a(s2.a) {}
38*38bcd483SFazlay Rabbi static float S2s;
39*38bcd483SFazlay Rabbi static const float S2sc;
40*38bcd483SFazlay Rabbi };
41*38bcd483SFazlay Rabbi const float S2::S2sc = 0;
42*38bcd483SFazlay Rabbi const S2 b;
43*38bcd483SFazlay Rabbi const S2 ba[5];
44*38bcd483SFazlay Rabbi class S3 {
45*38bcd483SFazlay Rabbi int a;
46*38bcd483SFazlay Rabbi S3 &operator=(const S3 &s3);
47*38bcd483SFazlay Rabbi
48*38bcd483SFazlay Rabbi public:
S3()49*38bcd483SFazlay Rabbi S3() : a(0) {} // expected-note 2 {{candidate constructor not viable: requires 0 arguments, but 1 was provided}}
S3(S3 & s3)50*38bcd483SFazlay Rabbi S3(S3 &s3) : a(s3.a) {} // expected-note 2 {{candidate constructor not viable: 1st argument ('const S3') would lose const qualifier}}
51*38bcd483SFazlay Rabbi };
52*38bcd483SFazlay Rabbi const S3 c;
53*38bcd483SFazlay Rabbi const S3 ca[5];
54*38bcd483SFazlay Rabbi extern const int f;
55*38bcd483SFazlay Rabbi class S4 {
56*38bcd483SFazlay Rabbi int a;
57*38bcd483SFazlay Rabbi S4();
58*38bcd483SFazlay Rabbi S4(const S4 &s4); // expected-note 2 {{implicitly declared private here}}
59*38bcd483SFazlay Rabbi
60*38bcd483SFazlay Rabbi public:
S4(int v)61*38bcd483SFazlay Rabbi S4(int v) : a(v) {}
62*38bcd483SFazlay Rabbi };
63*38bcd483SFazlay Rabbi class S5 {
64*38bcd483SFazlay Rabbi int a;
S5(const S5 & s5)65*38bcd483SFazlay Rabbi S5(const S5 &s5) : a(s5.a) {} // expected-note 4 {{implicitly declared private here}}
66*38bcd483SFazlay Rabbi
67*38bcd483SFazlay Rabbi public:
S5()68*38bcd483SFazlay Rabbi S5() : a(0) {}
S5(int v)69*38bcd483SFazlay Rabbi S5(int v) : a(v) {}
70*38bcd483SFazlay Rabbi };
71*38bcd483SFazlay Rabbi class S6 {
72*38bcd483SFazlay Rabbi int a;
S6()73*38bcd483SFazlay Rabbi S6() : a(0) {}
74*38bcd483SFazlay Rabbi
75*38bcd483SFazlay Rabbi public:
S6(const S6 & s6)76*38bcd483SFazlay Rabbi S6(const S6 &s6) : a(s6.a) {}
S6(int v)77*38bcd483SFazlay Rabbi S6(int v) : a(v) {}
78*38bcd483SFazlay Rabbi };
79*38bcd483SFazlay Rabbi
80*38bcd483SFazlay Rabbi S3 h;
81*38bcd483SFazlay Rabbi #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
82*38bcd483SFazlay Rabbi
83*38bcd483SFazlay Rabbi template <class I, class C>
foomain(int argc,char ** argv)84*38bcd483SFazlay Rabbi int foomain(int argc, char **argv) {
85*38bcd483SFazlay Rabbi I e(4);
86*38bcd483SFazlay Rabbi C g(5);
87*38bcd483SFazlay Rabbi int i, z;
88*38bcd483SFazlay Rabbi int &j = i;
89*38bcd483SFazlay Rabbi #pragma omp parallel
90*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate // expected-error {{expected '(' after 'firstprivate'}}
91*38bcd483SFazlay Rabbi for (int k = 0; k < argc; ++k)
92*38bcd483SFazlay Rabbi ++k;
93*38bcd483SFazlay Rabbi #pragma omp parallel
94*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
95*38bcd483SFazlay Rabbi for (int k = 0; k < argc; ++k)
96*38bcd483SFazlay Rabbi ++k;
97*38bcd483SFazlay Rabbi #pragma omp parallel
98*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate() // expected-error {{expected expression}}
99*38bcd483SFazlay Rabbi for (int k = 0; k < argc; ++k)
100*38bcd483SFazlay Rabbi ++k;
101*38bcd483SFazlay Rabbi #pragma omp parallel
102*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
103*38bcd483SFazlay Rabbi for (int k = 0; k < argc; ++k)
104*38bcd483SFazlay Rabbi ++k;
105*38bcd483SFazlay Rabbi #pragma omp parallel
106*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
107*38bcd483SFazlay Rabbi for (int k = 0; k < argc; ++k)
108*38bcd483SFazlay Rabbi ++k;
109*38bcd483SFazlay Rabbi #pragma omp parallel
110*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
111*38bcd483SFazlay Rabbi for (int k = 0; k < argc; ++k)
112*38bcd483SFazlay Rabbi ++k;
113*38bcd483SFazlay Rabbi #pragma omp parallel
114*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd allocate(omp_thread_mem_alloc: argc) firstprivate(argc) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'parallel masked taskloop simd' directive}}
115*38bcd483SFazlay Rabbi for (int k = 0; k < argc; ++k)
116*38bcd483SFazlay Rabbi ++k;
117*38bcd483SFazlay Rabbi #pragma omp parallel
118*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(S1) // expected-error {{'S1' does not refer to a value}}
119*38bcd483SFazlay Rabbi for (int k = 0; k < argc; ++k)
120*38bcd483SFazlay Rabbi ++k;
121*38bcd483SFazlay Rabbi #pragma omp parallel
122*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(a, b) // expected-error {{firstprivate variable with incomplete type 'S1'}}
123*38bcd483SFazlay Rabbi for (int k = 0; k < argc; ++k)
124*38bcd483SFazlay Rabbi ++k;
125*38bcd483SFazlay Rabbi #pragma omp parallel
126*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(argv[1]) // expected-error {{expected variable name}}
127*38bcd483SFazlay Rabbi for (int k = 0; k < argc; ++k)
128*38bcd483SFazlay Rabbi ++k;
129*38bcd483SFazlay Rabbi #pragma omp parallel
130*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(z, e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
131*38bcd483SFazlay Rabbi for (int k = 0; k < argc; ++k)
132*38bcd483SFazlay Rabbi ++k;
133*38bcd483SFazlay Rabbi #pragma omp parallel
134*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
135*38bcd483SFazlay Rabbi for (int k = 0; k < argc; ++k)
136*38bcd483SFazlay Rabbi ++k;
137*38bcd483SFazlay Rabbi #pragma omp parallel
138*38bcd483SFazlay Rabbi {
139*38bcd483SFazlay Rabbi int v = 0;
140*38bcd483SFazlay Rabbi int i;
141*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(i)
142*38bcd483SFazlay Rabbi for (int k = 0; k < argc; ++k) {
143*38bcd483SFazlay Rabbi i = k;
144*38bcd483SFazlay Rabbi v += i;
145*38bcd483SFazlay Rabbi }
146*38bcd483SFazlay Rabbi }
147*38bcd483SFazlay Rabbi #pragma omp parallel shared(i)
148*38bcd483SFazlay Rabbi #pragma omp parallel private(i)
149*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(j)
150*38bcd483SFazlay Rabbi for (int k = 0; k < argc; ++k)
151*38bcd483SFazlay Rabbi ++k;
152*38bcd483SFazlay Rabbi #pragma omp parallel
153*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(i)
154*38bcd483SFazlay Rabbi for (int k = 0; k < argc; ++k)
155*38bcd483SFazlay Rabbi ++k;
156*38bcd483SFazlay Rabbi #pragma omp parallel
157*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}}
158*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
159*38bcd483SFazlay Rabbi foo();
160*38bcd483SFazlay Rabbi #pragma omp parallel private(i)
161*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(i) // expected-note 2 {{defined as firstprivate}}
162*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i) // expected-error 2 {{loop iteration variable in the associated loop of 'omp parallel masked taskloop simd' directive may not be firstprivate, predetermined as linear}}
163*38bcd483SFazlay Rabbi foo();
164*38bcd483SFazlay Rabbi #pragma omp parallel reduction(+ : i) // expected-note {{defined as reduction}}
165*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(i) // expected-note {{defined as firstprivate}} expected-error {{argument of a reduction clause of a parallel construct must not appear in a firstprivate clause on a task construct}}
166*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp parallel masked taskloop simd' directive may not be firstprivate, predetermined as linear}}
167*38bcd483SFazlay Rabbi foo();
168*38bcd483SFazlay Rabbi return 0;
169*38bcd483SFazlay Rabbi }
170*38bcd483SFazlay Rabbi
bar(S4 a[2])171*38bcd483SFazlay Rabbi void bar(S4 a[2]) {
172*38bcd483SFazlay Rabbi #pragma omp parallel
173*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(a)
174*38bcd483SFazlay Rabbi for (int i = 0; i < 2; ++i)
175*38bcd483SFazlay Rabbi foo();
176*38bcd483SFazlay Rabbi }
177*38bcd483SFazlay Rabbi
178*38bcd483SFazlay Rabbi namespace A {
179*38bcd483SFazlay Rabbi double x;
180*38bcd483SFazlay Rabbi #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
181*38bcd483SFazlay Rabbi }
182*38bcd483SFazlay Rabbi namespace B {
183*38bcd483SFazlay Rabbi using A::x;
184*38bcd483SFazlay Rabbi }
185*38bcd483SFazlay Rabbi
main(int argc,char ** argv)186*38bcd483SFazlay Rabbi int main(int argc, char **argv) {
187*38bcd483SFazlay Rabbi const int d = 5;
188*38bcd483SFazlay Rabbi const int da[5] = {0};
189*38bcd483SFazlay Rabbi S4 e(4);
190*38bcd483SFazlay Rabbi S5 g(5);
191*38bcd483SFazlay Rabbi S3 m;
192*38bcd483SFazlay Rabbi S6 n(2);
193*38bcd483SFazlay Rabbi int i;
194*38bcd483SFazlay Rabbi int &j = i;
195*38bcd483SFazlay Rabbi #pragma omp parallel
196*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate // expected-error {{expected '(' after 'firstprivate'}}
197*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
198*38bcd483SFazlay Rabbi foo();
199*38bcd483SFazlay Rabbi #pragma omp parallel
200*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
201*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
202*38bcd483SFazlay Rabbi foo();
203*38bcd483SFazlay Rabbi #pragma omp parallel
204*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate() // expected-error {{expected expression}}
205*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
206*38bcd483SFazlay Rabbi foo();
207*38bcd483SFazlay Rabbi #pragma omp parallel
208*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
209*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
210*38bcd483SFazlay Rabbi foo();
211*38bcd483SFazlay Rabbi #pragma omp parallel
212*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
213*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
214*38bcd483SFazlay Rabbi foo();
215*38bcd483SFazlay Rabbi #pragma omp parallel
216*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
217*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
218*38bcd483SFazlay Rabbi foo();
219*38bcd483SFazlay Rabbi #pragma omp parallel
220*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(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 '('}}
221*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
222*38bcd483SFazlay Rabbi foo();
223*38bcd483SFazlay Rabbi #pragma omp parallel
224*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(S1) // expected-error {{'S1' does not refer to a value}}
225*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
226*38bcd483SFazlay Rabbi foo();
227*38bcd483SFazlay Rabbi #pragma omp parallel
228*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} expected-error {{no matching constructor for initialization of 'S3'}}
229*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
230*38bcd483SFazlay Rabbi foo();
231*38bcd483SFazlay Rabbi #pragma omp parallel
232*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(argv[1]) // expected-error {{expected variable name}}
233*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
234*38bcd483SFazlay Rabbi foo();
235*38bcd483SFazlay Rabbi #pragma omp parallel
236*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(2 * 2) // expected-error {{expected variable name}}
237*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
238*38bcd483SFazlay Rabbi foo();
239*38bcd483SFazlay Rabbi #pragma omp parallel
240*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(ba) // OK
241*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
242*38bcd483SFazlay Rabbi foo();
243*38bcd483SFazlay Rabbi #pragma omp parallel
244*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(ca) // expected-error {{no matching constructor for initialization of 'S3'}}
245*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
246*38bcd483SFazlay Rabbi foo();
247*38bcd483SFazlay Rabbi #pragma omp parallel
248*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(da) // OK
249*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
250*38bcd483SFazlay Rabbi foo();
251*38bcd483SFazlay Rabbi int xa;
252*38bcd483SFazlay Rabbi #pragma omp parallel
253*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(xa) // OK
254*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
255*38bcd483SFazlay Rabbi foo();
256*38bcd483SFazlay Rabbi #pragma omp parallel
257*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(S2::S2s) // OK
258*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
259*38bcd483SFazlay Rabbi foo();
260*38bcd483SFazlay Rabbi #pragma omp parallel
261*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(S2::S2sc) // OK
262*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
263*38bcd483SFazlay Rabbi foo();
264*38bcd483SFazlay Rabbi #pragma omp parallel
265*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd safelen(5)
266*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
267*38bcd483SFazlay Rabbi foo();
268*38bcd483SFazlay Rabbi #pragma omp parallel
269*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
270*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
271*38bcd483SFazlay Rabbi foo();
272*38bcd483SFazlay Rabbi #pragma omp parallel
273*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(m) // OK
274*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
275*38bcd483SFazlay Rabbi foo();
276*38bcd483SFazlay Rabbi #pragma omp parallel
277*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
278*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
279*38bcd483SFazlay Rabbi foo();
280*38bcd483SFazlay Rabbi #pragma omp parallel
281*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd private(xa), firstprivate(xa) // expected-error {{private variable cannot be firstprivate}} expected-note {{defined as private}}
282*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
283*38bcd483SFazlay Rabbi foo();
284*38bcd483SFazlay Rabbi #pragma omp parallel
285*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(i) // expected-note {{defined as firstprivate}}
286*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp parallel masked taskloop simd' directive may not be firstprivate, predetermined as linear}}
287*38bcd483SFazlay Rabbi foo();
288*38bcd483SFazlay Rabbi #pragma omp parallel shared(xa)
289*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(xa) // OK: may be firstprivate
290*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
291*38bcd483SFazlay Rabbi foo();
292*38bcd483SFazlay Rabbi #pragma omp parallel
293*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(j)
294*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
295*38bcd483SFazlay Rabbi foo();
296*38bcd483SFazlay Rabbi #pragma omp parallel
297*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}}
298*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
299*38bcd483SFazlay Rabbi foo();
300*38bcd483SFazlay Rabbi #pragma omp parallel
301*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd lastprivate(n) firstprivate(n) // OK
302*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
303*38bcd483SFazlay Rabbi foo();
304*38bcd483SFazlay Rabbi #pragma omp parallel
305*38bcd483SFazlay Rabbi {
306*38bcd483SFazlay Rabbi int v = 0;
307*38bcd483SFazlay Rabbi int i;
308*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(i)
309*38bcd483SFazlay Rabbi for (int k = 0; k < argc; ++k) {
310*38bcd483SFazlay Rabbi i = k;
311*38bcd483SFazlay Rabbi v += i;
312*38bcd483SFazlay Rabbi }
313*38bcd483SFazlay Rabbi }
314*38bcd483SFazlay Rabbi #pragma omp parallel private(i)
315*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(i) // expected-note {{defined as firstprivate}}
316*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp parallel masked taskloop simd' directive may not be firstprivate, predetermined as linear}}
317*38bcd483SFazlay Rabbi foo();
318*38bcd483SFazlay Rabbi #pragma omp parallel reduction(+ : i) // expected-note {{defined as reduction}}
319*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(i) //expected-error {{argument of a reduction clause of a parallel construct must not appear in a firstprivate clause on a task construct}}
320*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
321*38bcd483SFazlay Rabbi foo();
322*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(i) //expected-note {{defined as firstprivate}}
323*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp parallel masked taskloop simd' directive may not be firstprivate, predetermined as linear}}
324*38bcd483SFazlay Rabbi foo();
325*38bcd483SFazlay Rabbi #pragma omp parallel
326*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(B::x) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
327*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
328*38bcd483SFazlay Rabbi foo();
329*38bcd483SFazlay Rabbi static int si;
330*38bcd483SFazlay Rabbi #pragma omp parallel masked taskloop simd firstprivate(si) // OK
331*38bcd483SFazlay Rabbi for (i = 0; i < argc; ++i)
332*38bcd483SFazlay Rabbi si = i + 1;
333*38bcd483SFazlay Rabbi
334*38bcd483SFazlay Rabbi return foomain<S4, S5>(argc, argv); // expected-note {{in instantiation of function template specialization 'foomain<S4, S5>' requested here}}
335*38bcd483SFazlay Rabbi }
336*38bcd483SFazlay Rabbi
337