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