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