114a388f4SAlexey Bataev // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
214a388f4SAlexey Bataev 
314a388f4SAlexey Bataev // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
414a388f4SAlexey Bataev 
514a388f4SAlexey Bataev typedef void **omp_allocator_handle_t;
6*8026394dSAlexey Bataev extern const omp_allocator_handle_t omp_null_allocator;
714a388f4SAlexey Bataev extern const omp_allocator_handle_t omp_default_mem_alloc;
814a388f4SAlexey Bataev extern const omp_allocator_handle_t omp_large_cap_mem_alloc;
914a388f4SAlexey Bataev extern const omp_allocator_handle_t omp_const_mem_alloc;
1014a388f4SAlexey Bataev extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
1114a388f4SAlexey Bataev extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
1214a388f4SAlexey Bataev extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
1314a388f4SAlexey Bataev extern const omp_allocator_handle_t omp_pteam_mem_alloc;
1414a388f4SAlexey Bataev extern const omp_allocator_handle_t omp_thread_mem_alloc;
1514a388f4SAlexey Bataev 
foo()1614a388f4SAlexey Bataev void foo() {
1714a388f4SAlexey Bataev }
1814a388f4SAlexey Bataev 
foobool(int argc)1914a388f4SAlexey Bataev bool foobool(int argc) {
2014a388f4SAlexey Bataev   return argc;
2114a388f4SAlexey Bataev }
2214a388f4SAlexey Bataev 
xxx(int argc)2314a388f4SAlexey Bataev void xxx(int argc) {
2414a388f4SAlexey Bataev   int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
2514a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
2614a388f4SAlexey Bataev   for (int i = 0; i < 10; ++i)
2714a388f4SAlexey Bataev     ;
2814a388f4SAlexey Bataev }
2914a388f4SAlexey Bataev 
3014a388f4SAlexey Bataev struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
3114a388f4SAlexey Bataev extern S1 a;
3214a388f4SAlexey Bataev class S2 {
3314a388f4SAlexey Bataev   mutable int a;
3414a388f4SAlexey Bataev 
3514a388f4SAlexey Bataev public:
S2()3614a388f4SAlexey Bataev   S2() : a(0) {}
S2(const S2 & s2)3714a388f4SAlexey Bataev   S2(const S2 &s2) : a(s2.a) {}
3814a388f4SAlexey Bataev   static float S2s;
3914a388f4SAlexey Bataev   static const float S2sc;
4014a388f4SAlexey Bataev };
4114a388f4SAlexey Bataev const float S2::S2sc = 0;
4214a388f4SAlexey Bataev const S2 b;
4314a388f4SAlexey Bataev const S2 ba[5];
4414a388f4SAlexey Bataev class S3 {
4514a388f4SAlexey Bataev   int a;
4614a388f4SAlexey Bataev   S3 &operator=(const S3 &s3);
4714a388f4SAlexey Bataev 
4814a388f4SAlexey Bataev public:
S3()4914a388f4SAlexey Bataev   S3() : a(0) {} // expected-note 2 {{candidate constructor not viable: requires 0 arguments, but 1 was provided}}
S3(S3 & s3)5014a388f4SAlexey Bataev   S3(S3 &s3) : a(s3.a) {} // expected-note 2 {{candidate constructor not viable: 1st argument ('const S3') would lose const qualifier}}
5114a388f4SAlexey Bataev };
5214a388f4SAlexey Bataev const S3 c;
5314a388f4SAlexey Bataev const S3 ca[5];
5414a388f4SAlexey Bataev extern const int f;
5514a388f4SAlexey Bataev class S4 {
5614a388f4SAlexey Bataev   int a;
5714a388f4SAlexey Bataev   S4();
5814a388f4SAlexey Bataev   S4(const S4 &s4); // expected-note 2 {{implicitly declared private here}}
5914a388f4SAlexey Bataev 
6014a388f4SAlexey Bataev public:
S4(int v)6114a388f4SAlexey Bataev   S4(int v) : a(v) {}
6214a388f4SAlexey Bataev };
6314a388f4SAlexey Bataev class S5 {
6414a388f4SAlexey Bataev   int a;
S5(const S5 & s5)6514a388f4SAlexey Bataev   S5(const S5 &s5) : a(s5.a) {} // expected-note 4 {{implicitly declared private here}}
6614a388f4SAlexey Bataev 
6714a388f4SAlexey Bataev public:
S5()6814a388f4SAlexey Bataev   S5() : a(0) {}
S5(int v)6914a388f4SAlexey Bataev   S5(int v) : a(v) {}
7014a388f4SAlexey Bataev };
7114a388f4SAlexey Bataev class S6 {
7214a388f4SAlexey Bataev   int a;
S6()7314a388f4SAlexey Bataev   S6() : a(0) {}
7414a388f4SAlexey Bataev 
7514a388f4SAlexey Bataev public:
S6(const S6 & s6)7614a388f4SAlexey Bataev   S6(const S6 &s6) : a(s6.a) {}
S6(int v)7714a388f4SAlexey Bataev   S6(int v) : a(v) {}
7814a388f4SAlexey Bataev };
7914a388f4SAlexey Bataev 
8014a388f4SAlexey Bataev S3 h;
8114a388f4SAlexey Bataev #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
8214a388f4SAlexey Bataev 
8314a388f4SAlexey Bataev template <class I, class C>
foomain(int argc,char ** argv)8414a388f4SAlexey Bataev int foomain(int argc, char **argv) {
8514a388f4SAlexey Bataev   I e(4);
8614a388f4SAlexey Bataev   C g(5);
8714a388f4SAlexey Bataev   int i, z;
8814a388f4SAlexey Bataev   int &j = i;
8914a388f4SAlexey Bataev #pragma omp parallel
9014a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate // expected-error {{expected '(' after 'firstprivate'}}
9114a388f4SAlexey Bataev   for (int k = 0; k < argc; ++k)
9214a388f4SAlexey Bataev     ++k;
9314a388f4SAlexey Bataev #pragma omp parallel
9414a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
9514a388f4SAlexey Bataev   for (int k = 0; k < argc; ++k)
9614a388f4SAlexey Bataev     ++k;
9714a388f4SAlexey Bataev #pragma omp parallel
9814a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate() // expected-error {{expected expression}}
9914a388f4SAlexey Bataev   for (int k = 0; k < argc; ++k)
10014a388f4SAlexey Bataev     ++k;
10114a388f4SAlexey Bataev #pragma omp parallel
10214a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
10314a388f4SAlexey Bataev   for (int k = 0; k < argc; ++k)
10414a388f4SAlexey Bataev     ++k;
10514a388f4SAlexey Bataev #pragma omp parallel
10614a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
10714a388f4SAlexey Bataev   for (int k = 0; k < argc; ++k)
10814a388f4SAlexey Bataev     ++k;
10914a388f4SAlexey Bataev #pragma omp parallel
11014a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
11114a388f4SAlexey Bataev   for (int k = 0; k < argc; ++k)
11214a388f4SAlexey Bataev     ++k;
11314a388f4SAlexey Bataev #pragma omp parallel
11414a388f4SAlexey Bataev #pragma omp parallel master taskloop simd allocate(omp_thread_mem_alloc: argc) firstprivate(argc) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'parallel master taskloop simd' directive}}
11514a388f4SAlexey Bataev   for (int k = 0; k < argc; ++k)
11614a388f4SAlexey Bataev     ++k;
11714a388f4SAlexey Bataev #pragma omp parallel
11814a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(S1) // expected-error {{'S1' does not refer to a value}}
11914a388f4SAlexey Bataev   for (int k = 0; k < argc; ++k)
12014a388f4SAlexey Bataev     ++k;
12114a388f4SAlexey Bataev #pragma omp parallel
12214a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(a, b) // expected-error {{firstprivate variable with incomplete type 'S1'}}
12314a388f4SAlexey Bataev   for (int k = 0; k < argc; ++k)
12414a388f4SAlexey Bataev     ++k;
12514a388f4SAlexey Bataev #pragma omp parallel
12614a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(argv[1]) // expected-error {{expected variable name}}
12714a388f4SAlexey Bataev   for (int k = 0; k < argc; ++k)
12814a388f4SAlexey Bataev     ++k;
12914a388f4SAlexey Bataev #pragma omp parallel
13014a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(z, e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
13114a388f4SAlexey Bataev   for (int k = 0; k < argc; ++k)
13214a388f4SAlexey Bataev     ++k;
13314a388f4SAlexey Bataev #pragma omp parallel
13414a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
13514a388f4SAlexey Bataev   for (int k = 0; k < argc; ++k)
13614a388f4SAlexey Bataev     ++k;
13714a388f4SAlexey Bataev #pragma omp parallel
13814a388f4SAlexey Bataev   {
13914a388f4SAlexey Bataev     int v = 0;
14014a388f4SAlexey Bataev     int i;
14114a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(i)
14214a388f4SAlexey Bataev     for (int k = 0; k < argc; ++k) {
14314a388f4SAlexey Bataev       i = k;
14414a388f4SAlexey Bataev       v += i;
14514a388f4SAlexey Bataev     }
14614a388f4SAlexey Bataev   }
14714a388f4SAlexey Bataev #pragma omp parallel shared(i)
14814a388f4SAlexey Bataev #pragma omp parallel private(i)
14914a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(j)
15014a388f4SAlexey Bataev   for (int k = 0; k < argc; ++k)
15114a388f4SAlexey Bataev     ++k;
15214a388f4SAlexey Bataev #pragma omp parallel
15314a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(i)
15414a388f4SAlexey Bataev   for (int k = 0; k < argc; ++k)
15514a388f4SAlexey Bataev     ++k;
15614a388f4SAlexey Bataev #pragma omp parallel
15714a388f4SAlexey Bataev #pragma omp parallel master taskloop simd lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}}
15814a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
15914a388f4SAlexey Bataev     foo();
16014a388f4SAlexey Bataev #pragma omp parallel private(i)
16114a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(i) // expected-note 2 {{defined as firstprivate}}
16214a388f4SAlexey Bataev   for (i = 0; i < argc; ++i) // expected-error 2 {{loop iteration variable in the associated loop of 'omp parallel master taskloop simd' directive may not be firstprivate, predetermined as linear}}
16314a388f4SAlexey Bataev     foo();
16414a388f4SAlexey Bataev #pragma omp parallel reduction(+ : i)  // expected-note {{defined as reduction}}
16514a388f4SAlexey Bataev #pragma omp parallel 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}}
16614a388f4SAlexey Bataev   for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp parallel master taskloop simd' directive may not be firstprivate, predetermined as linear}}
16714a388f4SAlexey Bataev     foo();
16814a388f4SAlexey Bataev   return 0;
16914a388f4SAlexey Bataev }
17014a388f4SAlexey Bataev 
bar(S4 a[2])17114a388f4SAlexey Bataev void bar(S4 a[2]) {
17214a388f4SAlexey Bataev #pragma omp parallel
17314a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(a)
17414a388f4SAlexey Bataev   for (int i = 0; i < 2; ++i)
17514a388f4SAlexey Bataev     foo();
17614a388f4SAlexey Bataev }
17714a388f4SAlexey Bataev 
17814a388f4SAlexey Bataev namespace A {
17914a388f4SAlexey Bataev double x;
18014a388f4SAlexey Bataev #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
18114a388f4SAlexey Bataev }
18214a388f4SAlexey Bataev namespace B {
18314a388f4SAlexey Bataev using A::x;
18414a388f4SAlexey Bataev }
18514a388f4SAlexey Bataev 
main(int argc,char ** argv)18614a388f4SAlexey Bataev int main(int argc, char **argv) {
18714a388f4SAlexey Bataev   const int d = 5;
18814a388f4SAlexey Bataev   const int da[5] = {0};
18914a388f4SAlexey Bataev   S4 e(4);
19014a388f4SAlexey Bataev   S5 g(5);
19114a388f4SAlexey Bataev   S3 m;
19214a388f4SAlexey Bataev   S6 n(2);
19314a388f4SAlexey Bataev   int i;
19414a388f4SAlexey Bataev   int &j = i;
19514a388f4SAlexey Bataev #pragma omp parallel
19614a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate // expected-error {{expected '(' after 'firstprivate'}}
19714a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
19814a388f4SAlexey Bataev     foo();
19914a388f4SAlexey Bataev #pragma omp parallel
20014a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
20114a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
20214a388f4SAlexey Bataev     foo();
20314a388f4SAlexey Bataev #pragma omp parallel
20414a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate() // expected-error {{expected expression}}
20514a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
20614a388f4SAlexey Bataev     foo();
20714a388f4SAlexey Bataev #pragma omp parallel
20814a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
20914a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
21014a388f4SAlexey Bataev     foo();
21114a388f4SAlexey Bataev #pragma omp parallel
21214a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
21314a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
21414a388f4SAlexey Bataev     foo();
21514a388f4SAlexey Bataev #pragma omp parallel
21614a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
21714a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
21814a388f4SAlexey Bataev     foo();
21914a388f4SAlexey Bataev #pragma omp parallel
22014a388f4SAlexey Bataev #pragma omp parallel 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 '('}}
22114a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
22214a388f4SAlexey Bataev     foo();
22314a388f4SAlexey Bataev #pragma omp parallel
22414a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(S1) // expected-error {{'S1' does not refer to a value}}
22514a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
22614a388f4SAlexey Bataev     foo();
22714a388f4SAlexey Bataev #pragma omp parallel
22814a388f4SAlexey Bataev #pragma omp parallel 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'}}
22914a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
23014a388f4SAlexey Bataev     foo();
23114a388f4SAlexey Bataev #pragma omp parallel
23214a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(argv[1]) // expected-error {{expected variable name}}
23314a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
23414a388f4SAlexey Bataev     foo();
23514a388f4SAlexey Bataev #pragma omp parallel
23614a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(2 * 2) // expected-error {{expected variable name}}
23714a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
23814a388f4SAlexey Bataev     foo();
23914a388f4SAlexey Bataev #pragma omp parallel
24014a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(ba) // OK
24114a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
24214a388f4SAlexey Bataev     foo();
24314a388f4SAlexey Bataev #pragma omp parallel
24414a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(ca) // expected-error {{no matching constructor for initialization of 'S3'}}
24514a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
24614a388f4SAlexey Bataev     foo();
24714a388f4SAlexey Bataev #pragma omp parallel
24814a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(da) // OK
24914a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
25014a388f4SAlexey Bataev     foo();
25114a388f4SAlexey Bataev   int xa;
25214a388f4SAlexey Bataev #pragma omp parallel
25314a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(xa) // OK
25414a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
25514a388f4SAlexey Bataev     foo();
25614a388f4SAlexey Bataev #pragma omp parallel
25714a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(S2::S2s) // OK
25814a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
25914a388f4SAlexey Bataev     foo();
26014a388f4SAlexey Bataev #pragma omp parallel
26114a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(S2::S2sc) // OK
26214a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
26314a388f4SAlexey Bataev     foo();
26414a388f4SAlexey Bataev #pragma omp parallel
26514a388f4SAlexey Bataev #pragma omp parallel master taskloop simd safelen(5)
26614a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
26714a388f4SAlexey Bataev     foo();
26814a388f4SAlexey Bataev #pragma omp parallel
26914a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
27014a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
27114a388f4SAlexey Bataev     foo();
27214a388f4SAlexey Bataev #pragma omp parallel
27314a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(m) // OK
27414a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
27514a388f4SAlexey Bataev     foo();
27614a388f4SAlexey Bataev #pragma omp parallel
27714a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
27814a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
27914a388f4SAlexey Bataev     foo();
28014a388f4SAlexey Bataev #pragma omp parallel
28114a388f4SAlexey Bataev #pragma omp parallel master taskloop simd private(xa), firstprivate(xa) // expected-error {{private variable cannot be firstprivate}} expected-note {{defined as private}}
28214a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
28314a388f4SAlexey Bataev     foo();
28414a388f4SAlexey Bataev #pragma omp parallel
28514a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(i) // expected-note {{defined as firstprivate}}
28614a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)    // expected-error {{loop iteration variable in the associated loop of 'omp parallel master taskloop simd' directive may not be firstprivate, predetermined as linear}}
28714a388f4SAlexey Bataev     foo();
28814a388f4SAlexey Bataev #pragma omp parallel shared(xa)
28914a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(xa) // OK: may be firstprivate
29014a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
29114a388f4SAlexey Bataev     foo();
29214a388f4SAlexey Bataev #pragma omp parallel
29314a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(j)
29414a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
29514a388f4SAlexey Bataev     foo();
29614a388f4SAlexey Bataev #pragma omp parallel
29714a388f4SAlexey Bataev #pragma omp parallel master taskloop simd lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}}
29814a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
29914a388f4SAlexey Bataev     foo();
30014a388f4SAlexey Bataev #pragma omp parallel
30114a388f4SAlexey Bataev #pragma omp parallel master taskloop simd lastprivate(n) firstprivate(n) // OK
30214a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
30314a388f4SAlexey Bataev     foo();
30414a388f4SAlexey Bataev #pragma omp parallel
30514a388f4SAlexey Bataev   {
30614a388f4SAlexey Bataev     int v = 0;
30714a388f4SAlexey Bataev     int i;
30814a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(i)
30914a388f4SAlexey Bataev     for (int k = 0; k < argc; ++k) {
31014a388f4SAlexey Bataev       i = k;
31114a388f4SAlexey Bataev       v += i;
31214a388f4SAlexey Bataev     }
31314a388f4SAlexey Bataev   }
31414a388f4SAlexey Bataev #pragma omp parallel private(i)
31514a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(i) // expected-note {{defined as firstprivate}}
31614a388f4SAlexey Bataev   for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp parallel master taskloop simd' directive may not be firstprivate, predetermined as linear}}
31714a388f4SAlexey Bataev     foo();
31814a388f4SAlexey Bataev #pragma omp parallel reduction(+ : i) // expected-note {{defined as reduction}}
31914a388f4SAlexey Bataev #pragma omp parallel 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}}
32014a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
32114a388f4SAlexey Bataev     foo();
32214a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(i) //expected-note {{defined as firstprivate}}
32314a388f4SAlexey Bataev   for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp parallel master taskloop simd' directive may not be firstprivate, predetermined as linear}}
32414a388f4SAlexey Bataev     foo();
32514a388f4SAlexey Bataev #pragma omp parallel
32614a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(B::x) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
32714a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
32814a388f4SAlexey Bataev     foo();
32914a388f4SAlexey Bataev   static int si;
33014a388f4SAlexey Bataev #pragma omp parallel master taskloop simd firstprivate(si) // OK
33114a388f4SAlexey Bataev   for (i = 0; i < argc; ++i)
33214a388f4SAlexey Bataev     si = i + 1;
33314a388f4SAlexey Bataev 
33414a388f4SAlexey Bataev   return foomain<S4, S5>(argc, argv); // expected-note {{in instantiation of function template specialization 'foomain<S4, S5>' requested here}}
33514a388f4SAlexey Bataev }
33614a388f4SAlexey Bataev 
337