11c1d9d9dSAlexey Bataev // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -ferror-limit 150 -o - %s -Wuninitialized
21c1d9d9dSAlexey Bataev // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
31c1d9d9dSAlexey Bataev // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
4ff260ad0SSaiyedul Islam // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -ferror-limit 150 -o - %s -Wuninitialized
5ff260ad0SSaiyedul Islam // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
6ff260ad0SSaiyedul Islam // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
760e51c48SAlexey Bataev
81c1d9d9dSAlexey Bataev // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -ferror-limit 150 -o - %s -Wuninitialized
91c1d9d9dSAlexey Bataev // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
101c1d9d9dSAlexey Bataev // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
11ff260ad0SSaiyedul Islam // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -ferror-limit 150 -o - %s -Wuninitialized
12ff260ad0SSaiyedul Islam // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
13ff260ad0SSaiyedul Islam // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
1460e51c48SAlexey Bataev
1560e51c48SAlexey Bataev typedef void **omp_allocator_handle_t;
168026394dSAlexey Bataev extern const omp_allocator_handle_t omp_null_allocator;
1760e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_default_mem_alloc;
1860e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_large_cap_mem_alloc;
1960e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_const_mem_alloc;
2060e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
2160e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
2260e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
2360e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_pteam_mem_alloc;
2460e51c48SAlexey Bataev extern const omp_allocator_handle_t omp_thread_mem_alloc;
2560e51c48SAlexey Bataev
xxx(int argc)2660e51c48SAlexey Bataev void xxx(int argc) {
2760e51c48SAlexey Bataev int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
2860e51c48SAlexey Bataev #pragma omp master taskloop reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
2960e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
3060e51c48SAlexey Bataev ;
3160e51c48SAlexey Bataev }
3260e51c48SAlexey Bataev
foo()3360e51c48SAlexey Bataev void foo() {
3460e51c48SAlexey Bataev }
3560e51c48SAlexey Bataev
foobool(int argc)3660e51c48SAlexey Bataev bool foobool(int argc) {
3760e51c48SAlexey Bataev return argc;
3860e51c48SAlexey Bataev }
3960e51c48SAlexey Bataev
foobar(int & ref)4060e51c48SAlexey Bataev void foobar(int &ref) {
4160e51c48SAlexey Bataev #pragma omp master taskloop reduction(+:ref)
4260e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
4360e51c48SAlexey Bataev foo();
4460e51c48SAlexey Bataev }
4560e51c48SAlexey Bataev
4660e51c48SAlexey Bataev struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
4760e51c48SAlexey Bataev extern S1 a;
4860e51c48SAlexey Bataev class S2 {
4960e51c48SAlexey Bataev mutable int a;
operator +(const S2 & arg)5060e51c48SAlexey Bataev S2 &operator+(const S2 &arg) { return (*this); } // expected-note 3 {{implicitly declared private here}}
5160e51c48SAlexey Bataev
5260e51c48SAlexey Bataev public:
S2()5360e51c48SAlexey Bataev S2() : a(0) {}
S2(S2 & s2)5460e51c48SAlexey Bataev S2(S2 &s2) : a(s2.a) {}
5560e51c48SAlexey Bataev static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
5660e51c48SAlexey Bataev static const float S2sc; // expected-note 2 {{'S2sc' declared here}}
5760e51c48SAlexey Bataev };
5860e51c48SAlexey Bataev const float S2::S2sc = 0;
5960e51c48SAlexey Bataev S2 b; // expected-note 3 {{'b' defined here}}
6060e51c48SAlexey Bataev const S2 ba[5]; // expected-note 2 {{'ba' defined here}}
6160e51c48SAlexey Bataev class S3 {
6260e51c48SAlexey Bataev int a;
6360e51c48SAlexey Bataev
6460e51c48SAlexey Bataev public:
6560e51c48SAlexey Bataev int b;
S3()6660e51c48SAlexey Bataev S3() : a(0) {}
S3(const S3 & s3)6760e51c48SAlexey Bataev S3(const S3 &s3) : a(s3.a) {}
operator +(const S3 & arg1)6860e51c48SAlexey Bataev S3 operator+(const S3 &arg1) { return arg1; }
6960e51c48SAlexey Bataev };
operator +(const S3 & arg1,const S3 & arg2)7060e51c48SAlexey Bataev int operator+(const S3 &arg1, const S3 &arg2) { return 5; }
7160e51c48SAlexey Bataev S3 c; // expected-note 3 {{'c' defined here}}
7260e51c48SAlexey Bataev const S3 ca[5]; // expected-note 2 {{'ca' defined here}}
7360e51c48SAlexey Bataev extern const int f; // expected-note 4 {{'f' declared here}}
7460e51c48SAlexey Bataev class S4 {
7560e51c48SAlexey Bataev int a;
7660e51c48SAlexey Bataev S4(); // expected-note {{implicitly declared private here}}
7760e51c48SAlexey Bataev S4(const S4 &s4);
operator +(const S4 & arg)7860e51c48SAlexey Bataev S4 &operator+(const S4 &arg) { return (*this); }
7960e51c48SAlexey Bataev
8060e51c48SAlexey Bataev public:
S4(int v)8160e51c48SAlexey Bataev S4(int v) : a(v) {}
8260e51c48SAlexey Bataev };
operator &=(S4 & arg1,S4 & arg2)8360e51c48SAlexey Bataev S4 &operator&=(S4 &arg1, S4 &arg2) { return arg1; }
8460e51c48SAlexey Bataev class S5 {
8560e51c48SAlexey Bataev int a:32;
S5()8660e51c48SAlexey Bataev S5() : a(0) {} // expected-note {{implicitly declared private here}}
S5(const S5 & s5)8760e51c48SAlexey Bataev S5(const S5 &s5) : a(s5.a) {}
8860e51c48SAlexey Bataev S5 &operator+(const S5 &arg);
8960e51c48SAlexey Bataev
9060e51c48SAlexey Bataev public:
S5(int v)9160e51c48SAlexey Bataev S5(int v) : a(v) {}
9260e51c48SAlexey Bataev };
9360e51c48SAlexey Bataev class S6 { // expected-note 3 {{candidate function (the implicit copy assignment operator) not viable: no known conversion from 'int' to 'const S6' for 1st argument}}
9460e51c48SAlexey Bataev #if __cplusplus >= 201103L // C++11 or later
9560e51c48SAlexey Bataev // expected-note@-2 3 {{candidate function (the implicit move assignment operator) not viable}}
9660e51c48SAlexey Bataev #endif
9760e51c48SAlexey Bataev int a;
9860e51c48SAlexey Bataev
9960e51c48SAlexey Bataev public:
S6()10060e51c48SAlexey Bataev S6() : a(6) {}
operator int()10160e51c48SAlexey Bataev operator int() { return 6; }
10260e51c48SAlexey Bataev } o;
10360e51c48SAlexey Bataev
10460e51c48SAlexey Bataev struct S7 {
10560e51c48SAlexey Bataev int a: 32;
S7S710660e51c48SAlexey Bataev S7() {
10760e51c48SAlexey Bataev #pragma omp master taskloop reduction(+:a) // expected-error {{expected addressable reduction item for the task-based directives}}
10860e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
10960e51c48SAlexey Bataev ++a;
11060e51c48SAlexey Bataev }
11160e51c48SAlexey Bataev };
11260e51c48SAlexey Bataev
11360e51c48SAlexey Bataev S3 h, k;
11460e51c48SAlexey Bataev #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
11560e51c48SAlexey Bataev
11660e51c48SAlexey Bataev template <class T> // expected-note {{declared here}}
tmain(T argc)11760e51c48SAlexey Bataev T tmain(T argc) {
11860e51c48SAlexey Bataev const T d = T(); // expected-note 4 {{'d' defined here}}
11960e51c48SAlexey Bataev const T da[5] = {T()}; // expected-note 2 {{'da' defined here}}
12060e51c48SAlexey Bataev T qa[5] = {T()};
12160e51c48SAlexey Bataev T i, z;
12260e51c48SAlexey Bataev T &j = i; // expected-note 4 {{'j' defined here}}
12360e51c48SAlexey Bataev S3 &p = k; // expected-note 2 {{'p' defined here}}
12460e51c48SAlexey Bataev const T &r = da[(int)i]; // expected-note 2 {{'r' defined here}}
12560e51c48SAlexey Bataev T &q = qa[(int)i]; // expected-note 2 {{'q' defined here}}
12660e51c48SAlexey Bataev T fl;
12760e51c48SAlexey Bataev #pragma omp master taskloop reduction // expected-error {{expected '(' after 'reduction'}}
12860e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
12960e51c48SAlexey Bataev foo();
13060e51c48SAlexey Bataev #pragma omp master taskloop reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp master taskloop' are ignored}}
13160e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
13260e51c48SAlexey Bataev foo();
13360e51c48SAlexey Bataev #pragma omp master taskloop reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
13460e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
13560e51c48SAlexey Bataev foo();
13660e51c48SAlexey Bataev #pragma omp master taskloop reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
13760e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
13860e51c48SAlexey Bataev foo();
13960e51c48SAlexey Bataev #pragma omp master taskloop reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
14060e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
14160e51c48SAlexey Bataev foo();
14260e51c48SAlexey Bataev #pragma omp master taskloop reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}}
14360e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
14460e51c48SAlexey Bataev foo();
14560e51c48SAlexey Bataev #pragma omp master taskloop reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
14660e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
14760e51c48SAlexey Bataev foo();
14860e51c48SAlexey Bataev #pragma omp master taskloop reduction(& : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{invalid operands to binary expression ('float' and 'float')}}
14960e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
15060e51c48SAlexey Bataev foo();
15160e51c48SAlexey Bataev #pragma omp master taskloop reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{invalid operands to binary expression ('float' and 'float')}}
15260e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
15360e51c48SAlexey Bataev foo();
15460e51c48SAlexey Bataev #pragma omp master taskloop reduction(|| : argc ? i : argc) // expected-error 2 {{expected variable name, array element or array section}}
15560e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
15660e51c48SAlexey Bataev foo();
15760e51c48SAlexey Bataev #pragma omp master taskloop reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}}
15860e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
15960e51c48SAlexey Bataev foo();
16060e51c48SAlexey Bataev #pragma omp master taskloop reduction(&& : 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 '('}}
16160e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
16260e51c48SAlexey Bataev foo();
16360e51c48SAlexey Bataev #pragma omp master taskloop reduction(^ : T) // expected-error {{'T' does not refer to a value}}
16460e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
16560e51c48SAlexey Bataev foo();
16660e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : z, a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 3 {{const-qualified variable cannot be reduction}} expected-error 2 {{'operator+' is a private member of 'S2'}}
16760e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
16860e51c48SAlexey Bataev foo();
16960e51c48SAlexey Bataev #pragma omp master taskloop reduction(min : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 4 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 3 {{const-qualified variable cannot be reduction}}
17060e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
17160e51c48SAlexey Bataev foo();
17260e51c48SAlexey Bataev #pragma omp master taskloop reduction(max : h.b) // expected-error {{expected variable name, array element or array section}}
17360e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
17460e51c48SAlexey Bataev foo();
17560e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : ba) // expected-error {{const-qualified variable cannot be reduction}}
17660e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
17760e51c48SAlexey Bataev foo();
17860e51c48SAlexey Bataev #pragma omp master taskloop reduction(* : ca) // expected-error {{const-qualified variable cannot be reduction}}
17960e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
18060e51c48SAlexey Bataev foo();
18160e51c48SAlexey Bataev #pragma omp master taskloop reduction(- : da) // expected-error {{const-qualified variable cannot be reduction}} expected-error {{const-qualified variable cannot be reduction}}
18260e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
18360e51c48SAlexey Bataev foo();
18460e51c48SAlexey Bataev #pragma omp master taskloop reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
18560e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
18660e51c48SAlexey Bataev foo();
18760e51c48SAlexey Bataev #pragma omp master taskloop reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
18860e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
18960e51c48SAlexey Bataev foo();
19060e51c48SAlexey Bataev #pragma omp master taskloop reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
19160e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
19260e51c48SAlexey Bataev foo();
19360e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}}
19460e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
19560e51c48SAlexey Bataev foo();
19660e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : o) // expected-error 2 {{no viable overloaded '='}}
19760e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
19860e51c48SAlexey Bataev foo();
19960e51c48SAlexey Bataev #pragma omp master taskloop private(i), reduction(+ : j), reduction(+ : q) // expected-error 4 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
20060e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
20160e51c48SAlexey Bataev foo();
20260e51c48SAlexey Bataev #pragma omp parallel private(k)
20360e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
20460e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
20560e51c48SAlexey Bataev foo();
20660e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : p), reduction(+ : p) // expected-error 2 {{variable can appear only once in OpenMP 'reduction' clause}} expected-note 2 {{previously referenced here}}
20760e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
20860e51c48SAlexey Bataev foo();
20960e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : r) // expected-error 2 {{const-qualified variable cannot be reduction}}
21060e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
21160e51c48SAlexey Bataev foo();
21260e51c48SAlexey Bataev #pragma omp parallel shared(i)
21360e51c48SAlexey Bataev #pragma omp parallel reduction(min : i)
21460e51c48SAlexey Bataev #pragma omp master taskloop reduction(max : j) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
21560e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
21660e51c48SAlexey Bataev foo();
21760e51c48SAlexey Bataev #pragma omp parallel private(fl)
21860e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'master taskloop' directive}}
21960e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
22060e51c48SAlexey Bataev foo();
22160e51c48SAlexey Bataev #pragma omp parallel reduction(* : fl)
22260e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : fl)
22360e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
22460e51c48SAlexey Bataev foo();
22560e51c48SAlexey Bataev
22660e51c48SAlexey Bataev return T();
22760e51c48SAlexey Bataev }
22860e51c48SAlexey Bataev
22960e51c48SAlexey Bataev namespace A {
23060e51c48SAlexey Bataev double x;
23160e51c48SAlexey Bataev #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
23260e51c48SAlexey Bataev }
23360e51c48SAlexey Bataev namespace B {
23460e51c48SAlexey Bataev using A::x;
23560e51c48SAlexey Bataev }
23660e51c48SAlexey Bataev
main(int argc,char ** argv)23760e51c48SAlexey Bataev int main(int argc, char **argv) {
23860e51c48SAlexey Bataev const int d = 5; // expected-note 2 {{'d' defined here}}
23960e51c48SAlexey Bataev const int da[5] = {0}; // expected-note {{'da' defined here}}
24060e51c48SAlexey Bataev int qa[5] = {0};
24160e51c48SAlexey Bataev S4 e(4);
24260e51c48SAlexey Bataev S5 g(5);
24360e51c48SAlexey Bataev int i, z;
24460e51c48SAlexey Bataev int &j = i; // expected-note 2 {{'j' defined here}}
24560e51c48SAlexey Bataev S3 &p = k; // expected-note 2 {{'p' defined here}}
24660e51c48SAlexey Bataev const int &r = da[i]; // expected-note {{'r' defined here}}
24760e51c48SAlexey Bataev int &q = qa[i]; // expected-note {{'q' defined here}}
24860e51c48SAlexey Bataev float fl;
24960e51c48SAlexey Bataev #pragma omp master taskloop reduction // expected-error {{expected '(' after 'reduction'}}
25060e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
25160e51c48SAlexey Bataev foo();
25260e51c48SAlexey Bataev #pragma omp master taskloop reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp master taskloop' are ignored}}
25360e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
25460e51c48SAlexey Bataev foo();
25560e51c48SAlexey Bataev #pragma omp master taskloop reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
25660e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
25760e51c48SAlexey Bataev foo();
25860e51c48SAlexey Bataev #pragma omp master taskloop reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
25960e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
26060e51c48SAlexey Bataev foo();
26160e51c48SAlexey Bataev #pragma omp master taskloop reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
26260e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
26360e51c48SAlexey Bataev foo();
26460e51c48SAlexey Bataev #pragma omp master taskloop reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}}
26560e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
26660e51c48SAlexey Bataev foo();
26760e51c48SAlexey Bataev #pragma omp master taskloop reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
26860e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
26960e51c48SAlexey Bataev foo();
27060e51c48SAlexey Bataev #pragma omp master taskloop reduction(foo : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max'}}
27160e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
27260e51c48SAlexey Bataev foo();
27360e51c48SAlexey Bataev #pragma omp master taskloop reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
27460e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
27560e51c48SAlexey Bataev foo();
27660e51c48SAlexey Bataev #pragma omp master taskloop reduction(|| : argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name, array element or array section}}
27760e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
27860e51c48SAlexey Bataev foo();
27960e51c48SAlexey Bataev #pragma omp master taskloop reduction(~ : argc) // expected-error {{expected unqualified-id}}
28060e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
28160e51c48SAlexey Bataev foo();
28260e51c48SAlexey Bataev #pragma omp master taskloop reduction(&& : argc, z)
28360e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
28460e51c48SAlexey Bataev foo();
28560e51c48SAlexey Bataev #pragma omp master taskloop reduction(^ : S1) // expected-error {{'S1' does not refer to a value}}
28660e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
28760e51c48SAlexey Bataev foo();
28860e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{const-qualified variable cannot be reduction}} expected-error {{'operator+' is a private member of 'S2'}}
28960e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
29060e51c48SAlexey Bataev foo();
29160e51c48SAlexey Bataev #pragma omp master taskloop reduction(min : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 2 {{const-qualified variable cannot be reduction}}
29260e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
29360e51c48SAlexey Bataev foo();
29460e51c48SAlexey Bataev #pragma omp master taskloop reduction(max : h.b) // expected-error {{expected variable name, array element or array section}}
29560e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
29660e51c48SAlexey Bataev foo();
29760e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : ba) // expected-error {{const-qualified variable cannot be reduction}}
29860e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
29960e51c48SAlexey Bataev foo();
30060e51c48SAlexey Bataev #pragma omp master taskloop reduction(* : ca) // expected-error {{const-qualified variable cannot be reduction}}
30160e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
30260e51c48SAlexey Bataev foo();
30360e51c48SAlexey Bataev #pragma omp master taskloop reduction(- : da) // expected-error {{const-qualified variable cannot be reduction}}
30460e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
30560e51c48SAlexey Bataev foo();
30660e51c48SAlexey Bataev #pragma omp master taskloop reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
30760e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
30860e51c48SAlexey Bataev foo();
30960e51c48SAlexey Bataev #pragma omp master taskloop reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
31060e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
31160e51c48SAlexey Bataev foo();
31260e51c48SAlexey Bataev #pragma omp master taskloop reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
31360e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
31460e51c48SAlexey Bataev foo();
315*f90abac6SMike Rice #pragma omp master taskloop reduction(& : e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} expected-error {{invalid operands to binary expression ('S5' and 'S5')}}
31660e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
31760e51c48SAlexey Bataev foo();
31860e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}}
31960e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
32060e51c48SAlexey Bataev foo();
32160e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : o) // expected-error {{no viable overloaded '='}}
32260e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
32360e51c48SAlexey Bataev foo();
32460e51c48SAlexey Bataev #pragma omp master taskloop private(i), reduction(+ : j), reduction(+ : q) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
32560e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
32660e51c48SAlexey Bataev foo();
32760e51c48SAlexey Bataev #pragma omp parallel private(k)
32860e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
32960e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
33060e51c48SAlexey Bataev foo();
33160e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : p), reduction(+ : p) // expected-error {{variable can appear only once in OpenMP 'reduction' clause}} expected-note {{previously referenced here}}
33260e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
33360e51c48SAlexey Bataev foo();
33460e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : r) // expected-error {{const-qualified variable cannot be reduction}}
33560e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
33660e51c48SAlexey Bataev foo();
33760e51c48SAlexey Bataev #pragma omp parallel shared(i)
33860e51c48SAlexey Bataev #pragma omp parallel reduction(min : i)
33960e51c48SAlexey Bataev #pragma omp master taskloop reduction(max : j) // expected-error {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
34060e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
34160e51c48SAlexey Bataev foo();
34260e51c48SAlexey Bataev #pragma omp parallel private(fl)
34360e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : fl)
34460e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
34560e51c48SAlexey Bataev foo();
34660e51c48SAlexey Bataev #pragma omp parallel reduction(* : fl)
34760e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : fl)
34860e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
34960e51c48SAlexey Bataev foo();
35060e51c48SAlexey Bataev static int m;
35160e51c48SAlexey Bataev #pragma omp master taskloop reduction(+ : m) // OK
35260e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
35360e51c48SAlexey Bataev m++;
35460e51c48SAlexey Bataev #pragma omp master taskloop nogroup reduction(+ : m) // expected-error {{'reduction' clause cannot be used with 'nogroup' clause}}
35560e51c48SAlexey Bataev for (int i = 0; i < 10; ++i)
35660e51c48SAlexey Bataev m++;
3571c1d9d9dSAlexey Bataev #pragma omp master taskloop reduction(task, + : m) // omp45-error 2 {{expected expression}} omp45-warning {{missing ':' after reduction identifier - ignoring}} omp50-error {{'reduction' clause with 'task' modifier allowed only on non-simd parallel or worksharing constructs}}
3581c1d9d9dSAlexey Bataev for (int i = 0; i < 10; ++i)
3591c1d9d9dSAlexey Bataev m++;
36060e51c48SAlexey Bataev
36160e51c48SAlexey Bataev return tmain(argc) + tmain(fl); // expected-note {{in instantiation of function template specialization 'tmain<int>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<float>' requested here}}
36260e51c48SAlexey Bataev }
363