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