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