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