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