xref: /llvm-project/clang/test/OpenMP/parallel_master_taskloop_firstprivate_messages.cpp (revision 8026394d3cc77db6f8172eeaa83b9747979c8642)
15bbceadfSAlexey Bataev // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
25bbceadfSAlexey Bataev 
35bbceadfSAlexey Bataev // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
45bbceadfSAlexey Bataev 
55bbceadfSAlexey Bataev typedef void **omp_allocator_handle_t;
6*8026394dSAlexey Bataev extern const omp_allocator_handle_t omp_null_allocator;
75bbceadfSAlexey Bataev extern const omp_allocator_handle_t omp_default_mem_alloc;
85bbceadfSAlexey Bataev extern const omp_allocator_handle_t omp_large_cap_mem_alloc;
95bbceadfSAlexey Bataev extern const omp_allocator_handle_t omp_const_mem_alloc;
105bbceadfSAlexey Bataev extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
115bbceadfSAlexey Bataev extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
125bbceadfSAlexey Bataev extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
135bbceadfSAlexey Bataev extern const omp_allocator_handle_t omp_pteam_mem_alloc;
145bbceadfSAlexey Bataev extern const omp_allocator_handle_t omp_thread_mem_alloc;
155bbceadfSAlexey Bataev 
foo()165bbceadfSAlexey Bataev void foo() {
175bbceadfSAlexey Bataev }
185bbceadfSAlexey Bataev 
foobool(int argc)195bbceadfSAlexey Bataev bool foobool(int argc) {
205bbceadfSAlexey Bataev   return argc;
215bbceadfSAlexey Bataev }
225bbceadfSAlexey Bataev 
xxx(int argc)235bbceadfSAlexey Bataev void xxx(int argc) {
245bbceadfSAlexey Bataev   int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
255bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
265bbceadfSAlexey Bataev   for (int i = 0; i < 10; ++i)
275bbceadfSAlexey Bataev     ;
285bbceadfSAlexey Bataev }
295bbceadfSAlexey Bataev 
305bbceadfSAlexey Bataev struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
315bbceadfSAlexey Bataev extern S1 a;
325bbceadfSAlexey Bataev class S2 {
335bbceadfSAlexey Bataev   mutable int a;
345bbceadfSAlexey Bataev 
355bbceadfSAlexey Bataev public:
S2()365bbceadfSAlexey Bataev   S2() : a(0) {}
S2(const S2 & s2)375bbceadfSAlexey Bataev   S2(const S2 &s2) : a(s2.a) {}
385bbceadfSAlexey Bataev   static float S2s;
395bbceadfSAlexey Bataev   static const float S2sc;
405bbceadfSAlexey Bataev };
415bbceadfSAlexey Bataev const float S2::S2sc = 0;
425bbceadfSAlexey Bataev const S2 b;
435bbceadfSAlexey Bataev const S2 ba[5];
445bbceadfSAlexey Bataev class S3 {
455bbceadfSAlexey Bataev   int a;
465bbceadfSAlexey Bataev   S3 &operator=(const S3 &s3);
475bbceadfSAlexey Bataev 
485bbceadfSAlexey Bataev public:
S3()495bbceadfSAlexey Bataev   S3() : a(0) {} // expected-note 2 {{candidate constructor not viable: requires 0 arguments, but 1 was provided}}
S3(S3 & s3)505bbceadfSAlexey Bataev   S3(S3 &s3) : a(s3.a) {} // expected-note 2 {{candidate constructor not viable: 1st argument ('const S3') would lose const qualifier}}
515bbceadfSAlexey Bataev };
525bbceadfSAlexey Bataev const S3 c;
535bbceadfSAlexey Bataev const S3 ca[5];
545bbceadfSAlexey Bataev extern const int f;
555bbceadfSAlexey Bataev class S4 {
565bbceadfSAlexey Bataev   int a;
575bbceadfSAlexey Bataev   S4();
585bbceadfSAlexey Bataev   S4(const S4 &s4); // expected-note 2 {{implicitly declared private here}}
595bbceadfSAlexey Bataev 
605bbceadfSAlexey Bataev public:
S4(int v)615bbceadfSAlexey Bataev   S4(int v) : a(v) {}
625bbceadfSAlexey Bataev };
635bbceadfSAlexey Bataev class S5 {
645bbceadfSAlexey Bataev   int a;
S5(const S5 & s5)655bbceadfSAlexey Bataev   S5(const S5 &s5) : a(s5.a) {} // expected-note 4 {{implicitly declared private here}}
665bbceadfSAlexey Bataev 
675bbceadfSAlexey Bataev public:
S5()685bbceadfSAlexey Bataev   S5() : a(0) {}
S5(int v)695bbceadfSAlexey Bataev   S5(int v) : a(v) {}
705bbceadfSAlexey Bataev };
715bbceadfSAlexey Bataev class S6 {
725bbceadfSAlexey Bataev   int a;
S6()735bbceadfSAlexey Bataev   S6() : a(0) {}
745bbceadfSAlexey Bataev 
755bbceadfSAlexey Bataev public:
S6(const S6 & s6)765bbceadfSAlexey Bataev   S6(const S6 &s6) : a(s6.a) {}
S6(int v)775bbceadfSAlexey Bataev   S6(int v) : a(v) {}
785bbceadfSAlexey Bataev };
795bbceadfSAlexey Bataev 
805bbceadfSAlexey Bataev S3 h;
815bbceadfSAlexey Bataev #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
825bbceadfSAlexey Bataev 
835bbceadfSAlexey Bataev template <class I, class C>
foomain(int argc,char ** argv)845bbceadfSAlexey Bataev int foomain(int argc, char **argv) {
855bbceadfSAlexey Bataev   I e(4);
865bbceadfSAlexey Bataev   C g(5);
875bbceadfSAlexey Bataev   int i, z;
885bbceadfSAlexey Bataev   int &j = i;
895bbceadfSAlexey Bataev #pragma omp parallel
905bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate // expected-error {{expected '(' after 'firstprivate'}}
915bbceadfSAlexey Bataev   for (int k = 0; k < argc; ++k)
925bbceadfSAlexey Bataev     ++k;
935bbceadfSAlexey Bataev #pragma omp parallel
945bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
955bbceadfSAlexey Bataev   for (int k = 0; k < argc; ++k)
965bbceadfSAlexey Bataev     ++k;
975bbceadfSAlexey Bataev #pragma omp parallel
985bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate() // expected-error {{expected expression}}
995bbceadfSAlexey Bataev   for (int k = 0; k < argc; ++k)
1005bbceadfSAlexey Bataev     ++k;
1015bbceadfSAlexey Bataev #pragma omp parallel
1025bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
1035bbceadfSAlexey Bataev   for (int k = 0; k < argc; ++k)
1045bbceadfSAlexey Bataev     ++k;
1055bbceadfSAlexey Bataev #pragma omp parallel
1065bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
1075bbceadfSAlexey Bataev   for (int k = 0; k < argc; ++k)
1085bbceadfSAlexey Bataev     ++k;
1095bbceadfSAlexey Bataev #pragma omp parallel
1105bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
1115bbceadfSAlexey Bataev   for (int k = 0; k < argc; ++k)
1125bbceadfSAlexey Bataev     ++k;
1135bbceadfSAlexey Bataev #pragma omp parallel
1145bbceadfSAlexey Bataev #pragma omp parallel master taskloop allocate(omp_thread_mem_alloc: argc) firstprivate(argc) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'parallel master taskloop' directive}}
1155bbceadfSAlexey Bataev   for (int k = 0; k < argc; ++k)
1165bbceadfSAlexey Bataev     ++k;
1175bbceadfSAlexey Bataev #pragma omp parallel
1185bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(S1) // expected-error {{'S1' does not refer to a value}}
1195bbceadfSAlexey Bataev   for (int k = 0; k < argc; ++k)
1205bbceadfSAlexey Bataev     ++k;
1215bbceadfSAlexey Bataev #pragma omp parallel
1225bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(a, b) // expected-error {{firstprivate variable with incomplete type 'S1'}}
1235bbceadfSAlexey Bataev   for (int k = 0; k < argc; ++k)
1245bbceadfSAlexey Bataev     ++k;
1255bbceadfSAlexey Bataev #pragma omp parallel
1265bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(argv[1]) // expected-error {{expected variable name}}
1275bbceadfSAlexey Bataev   for (int k = 0; k < argc; ++k)
1285bbceadfSAlexey Bataev     ++k;
1295bbceadfSAlexey Bataev #pragma omp parallel
1305bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(z, e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
1315bbceadfSAlexey Bataev   for (int k = 0; k < argc; ++k)
1325bbceadfSAlexey Bataev     ++k;
1335bbceadfSAlexey Bataev #pragma omp parallel
1345bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
1355bbceadfSAlexey Bataev   for (int k = 0; k < argc; ++k)
1365bbceadfSAlexey Bataev     ++k;
1375bbceadfSAlexey Bataev #pragma omp parallel
1385bbceadfSAlexey Bataev   {
1395bbceadfSAlexey Bataev     int v = 0;
1405bbceadfSAlexey Bataev     int i;
1415bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(i)
1425bbceadfSAlexey Bataev     for (int k = 0; k < argc; ++k) {
1435bbceadfSAlexey Bataev       i = k;
1445bbceadfSAlexey Bataev       v += i;
1455bbceadfSAlexey Bataev     }
1465bbceadfSAlexey Bataev   }
1475bbceadfSAlexey Bataev #pragma omp parallel shared(i)
1485bbceadfSAlexey Bataev #pragma omp parallel private(i)
1495bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(j)
1505bbceadfSAlexey Bataev   for (int k = 0; k < argc; ++k)
1515bbceadfSAlexey Bataev     ++k;
1525bbceadfSAlexey Bataev #pragma omp parallel
1535bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(i)
1545bbceadfSAlexey Bataev   for (int k = 0; k < argc; ++k)
1555bbceadfSAlexey Bataev     ++k;
1565bbceadfSAlexey Bataev #pragma omp parallel
1575bbceadfSAlexey Bataev #pragma omp parallel master taskloop lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}}
1585bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
1595bbceadfSAlexey Bataev     foo();
1605bbceadfSAlexey Bataev #pragma omp parallel private(i)
1615bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(i) // expected-note 2 {{defined as firstprivate}}
1625bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i) // expected-error 2 {{loop iteration variable in the associated loop of 'omp parallel master taskloop' directive may not be firstprivate, predetermined as private}}
1635bbceadfSAlexey Bataev     foo();
1645bbceadfSAlexey Bataev #pragma omp parallel reduction(+ : i)  // expected-note {{defined as reduction}}
1655bbceadfSAlexey Bataev #pragma omp parallel 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}}
1665bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp parallel master taskloop' directive may not be firstprivate, predetermined as private}}
1675bbceadfSAlexey Bataev     foo();
1685bbceadfSAlexey Bataev   return 0;
1695bbceadfSAlexey Bataev }
1705bbceadfSAlexey Bataev 
bar(S4 a[2])1715bbceadfSAlexey Bataev void bar(S4 a[2]) {
1725bbceadfSAlexey Bataev #pragma omp parallel
1735bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(a)
1745bbceadfSAlexey Bataev   for (int i = 0; i < 2; ++i)
1755bbceadfSAlexey Bataev     foo();
1765bbceadfSAlexey Bataev }
1775bbceadfSAlexey Bataev 
1785bbceadfSAlexey Bataev namespace A {
1795bbceadfSAlexey Bataev double x;
1805bbceadfSAlexey Bataev #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
1815bbceadfSAlexey Bataev }
1825bbceadfSAlexey Bataev namespace B {
1835bbceadfSAlexey Bataev using A::x;
1845bbceadfSAlexey Bataev }
1855bbceadfSAlexey Bataev 
main(int argc,char ** argv)1865bbceadfSAlexey Bataev int main(int argc, char **argv) {
1875bbceadfSAlexey Bataev   const int d = 5;
1885bbceadfSAlexey Bataev   const int da[5] = {0};
1895bbceadfSAlexey Bataev   S4 e(4);
1905bbceadfSAlexey Bataev   S5 g(5);
1915bbceadfSAlexey Bataev   S3 m;
1925bbceadfSAlexey Bataev   S6 n(2);
1935bbceadfSAlexey Bataev   int i;
1945bbceadfSAlexey Bataev   int &j = i;
1955bbceadfSAlexey Bataev #pragma omp parallel
1965bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate // expected-error {{expected '(' after 'firstprivate'}}
1975bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
1985bbceadfSAlexey Bataev     foo();
1995bbceadfSAlexey Bataev #pragma omp parallel
2005bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
2015bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2025bbceadfSAlexey Bataev     foo();
2035bbceadfSAlexey Bataev #pragma omp parallel
2045bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate() // expected-error {{expected expression}}
2055bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2065bbceadfSAlexey Bataev     foo();
2075bbceadfSAlexey Bataev #pragma omp parallel
2085bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
2095bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2105bbceadfSAlexey Bataev     foo();
2115bbceadfSAlexey Bataev #pragma omp parallel
2125bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
2135bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2145bbceadfSAlexey Bataev     foo();
2155bbceadfSAlexey Bataev #pragma omp parallel
2165bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
2175bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2185bbceadfSAlexey Bataev     foo();
2195bbceadfSAlexey Bataev #pragma omp parallel
2205bbceadfSAlexey Bataev #pragma omp parallel 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 '('}}
2215bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2225bbceadfSAlexey Bataev     foo();
2235bbceadfSAlexey Bataev #pragma omp parallel
2245bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(S1) // expected-error {{'S1' does not refer to a value}}
2255bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2265bbceadfSAlexey Bataev     foo();
2275bbceadfSAlexey Bataev #pragma omp parallel
2285bbceadfSAlexey Bataev #pragma omp parallel 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'}}
2295bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2305bbceadfSAlexey Bataev     foo();
2315bbceadfSAlexey Bataev #pragma omp parallel
2325bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(argv[1]) // expected-error {{expected variable name}}
2335bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2345bbceadfSAlexey Bataev     foo();
2355bbceadfSAlexey Bataev #pragma omp parallel
2365bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(2 * 2) // expected-error {{expected variable name}}
2375bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2385bbceadfSAlexey Bataev     foo();
2395bbceadfSAlexey Bataev #pragma omp parallel
2405bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(ba) // OK
2415bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2425bbceadfSAlexey Bataev     foo();
2435bbceadfSAlexey Bataev #pragma omp parallel
2445bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(ca) // expected-error {{no matching constructor for initialization of 'S3'}}
2455bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2465bbceadfSAlexey Bataev     foo();
2475bbceadfSAlexey Bataev #pragma omp parallel
2485bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(da) // OK
2495bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2505bbceadfSAlexey Bataev     foo();
2515bbceadfSAlexey Bataev   int xa;
2525bbceadfSAlexey Bataev #pragma omp parallel
2535bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(xa) // OK
2545bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2555bbceadfSAlexey Bataev     foo();
2565bbceadfSAlexey Bataev #pragma omp parallel
2575bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(S2::S2s) // OK
2585bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2595bbceadfSAlexey Bataev     foo();
2605bbceadfSAlexey Bataev #pragma omp parallel
2615bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(S2::S2sc) // OK
2625bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2635bbceadfSAlexey Bataev     foo();
2645bbceadfSAlexey Bataev #pragma omp parallel
2655bbceadfSAlexey Bataev #pragma omp parallel master taskloop safelen(5) // expected-error {{unexpected OpenMP clause 'safelen' in directive '#pragma omp parallel master taskloop'}}
2665bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2675bbceadfSAlexey Bataev     foo();
2685bbceadfSAlexey Bataev #pragma omp parallel
2695bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
2705bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2715bbceadfSAlexey Bataev     foo();
2725bbceadfSAlexey Bataev #pragma omp parallel
2735bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(m) // OK
2745bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2755bbceadfSAlexey Bataev     foo();
2765bbceadfSAlexey Bataev #pragma omp parallel
2775bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
2785bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2795bbceadfSAlexey Bataev     foo();
2805bbceadfSAlexey Bataev #pragma omp parallel
2815bbceadfSAlexey Bataev #pragma omp parallel master taskloop private(xa), firstprivate(xa) // expected-error {{private variable cannot be firstprivate}} expected-note {{defined as private}}
2825bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2835bbceadfSAlexey Bataev     foo();
2845bbceadfSAlexey Bataev #pragma omp parallel
2855bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(i) // expected-note {{defined as firstprivate}}
2865bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)    // expected-error {{loop iteration variable in the associated loop of 'omp parallel master taskloop' directive may not be firstprivate, predetermined as private}}
2875bbceadfSAlexey Bataev     foo();
2885bbceadfSAlexey Bataev #pragma omp parallel shared(xa)
2895bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(xa) // OK: may be firstprivate
2905bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2915bbceadfSAlexey Bataev     foo();
2925bbceadfSAlexey Bataev #pragma omp parallel
2935bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(j)
2945bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2955bbceadfSAlexey Bataev     foo();
2965bbceadfSAlexey Bataev #pragma omp parallel
2975bbceadfSAlexey Bataev #pragma omp parallel master taskloop lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}}
2985bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
2995bbceadfSAlexey Bataev     foo();
3005bbceadfSAlexey Bataev #pragma omp parallel
3015bbceadfSAlexey Bataev #pragma omp parallel master taskloop lastprivate(n) firstprivate(n) // OK
3025bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
3035bbceadfSAlexey Bataev     foo();
3045bbceadfSAlexey Bataev #pragma omp parallel
3055bbceadfSAlexey Bataev   {
3065bbceadfSAlexey Bataev     int v = 0;
3075bbceadfSAlexey Bataev     int i;
3085bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(i)
3095bbceadfSAlexey Bataev     for (int k = 0; k < argc; ++k) {
3105bbceadfSAlexey Bataev       i = k;
3115bbceadfSAlexey Bataev       v += i;
3125bbceadfSAlexey Bataev     }
3135bbceadfSAlexey Bataev   }
3145bbceadfSAlexey Bataev #pragma omp parallel private(i)
3155bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(i) // expected-note {{defined as firstprivate}}
3165bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp parallel master taskloop' directive may not be firstprivate, predetermined as private}}
3175bbceadfSAlexey Bataev     foo();
3185bbceadfSAlexey Bataev #pragma omp parallel reduction(+ : i) // expected-note {{defined as reduction}}
3195bbceadfSAlexey Bataev #pragma omp parallel 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}}
3205bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
3215bbceadfSAlexey Bataev     foo();
3225bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(i) //expected-note {{defined as firstprivate}}
3235bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp parallel master taskloop' directive may not be firstprivate, predetermined as private}}
3245bbceadfSAlexey Bataev     foo();
3255bbceadfSAlexey Bataev #pragma omp parallel
3265bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(B::x) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
3275bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
3285bbceadfSAlexey Bataev     foo();
3295bbceadfSAlexey Bataev   static int si;
3305bbceadfSAlexey Bataev #pragma omp parallel master taskloop firstprivate(si) // OK
3315bbceadfSAlexey Bataev   for (i = 0; i < argc; ++i)
3325bbceadfSAlexey Bataev     si = i + 1;
3335bbceadfSAlexey Bataev 
3345bbceadfSAlexey Bataev   return foomain<S4, S5>(argc, argv); // expected-note {{in instantiation of function template specialization 'foomain<S4, S5>' requested here}}
3355bbceadfSAlexey Bataev }
3365bbceadfSAlexey Bataev 
337