"Fossies" - the Fresh Open Source Software Archive

Member "cfe-9.0.0.src/test/OpenMP/target_teams_distribute_simd_reduction_messages.cpp" (8 Jul 2019, 17774 Bytes) of package /linux/misc/cfe-9.0.0.src.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "target_teams_distribute_simd_reduction_messages.cpp": 8.0.1_vs_9.0.0.

    1 // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
    2 // RUN: %clang_cc1 -verify -fopenmp -std=c++98 %s -Wuninitialized
    3 // RUN: %clang_cc1 -verify -fopenmp -std=c++11 %s -Wuninitialized
    4 
    5 // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
    6 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s -Wuninitialized
    7 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s -Wuninitialized
    8 
    9 typedef void **omp_allocator_handle_t;
   10 extern const omp_allocator_handle_t omp_default_mem_alloc;
   11 extern const omp_allocator_handle_t omp_large_cap_mem_alloc;
   12 extern const omp_allocator_handle_t omp_const_mem_alloc;
   13 extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
   14 extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
   15 extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
   16 extern const omp_allocator_handle_t omp_pteam_mem_alloc;
   17 extern const omp_allocator_handle_t omp_thread_mem_alloc;
   18 
   19 void foo() {
   20 }
   21 
   22 bool foobool(int argc) {
   23   return argc;
   24 }
   25 
   26 struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
   27 extern S1 a;
   28 class S2 {
   29   mutable int a;
   30   S2 &operator+(const S2 &arg) { return (*this); } // expected-note 3 {{implicitly declared private here}}
   31 
   32 public:
   33   S2() : a(0) {}
   34   S2(S2 &s2) : a(s2.a) {}
   35   static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
   36   static const float S2sc; // expected-note 2 {{'S2sc' declared here}}
   37 };
   38 const float S2::S2sc = 0;
   39 S2 b;                     // expected-note 3 {{'b' defined here}}
   40 const S2 ba[5];           // expected-note 2 {{'ba' defined here}}
   41 class S3 {
   42   int a;
   43 
   44 public:
   45   int b;
   46   S3() : a(0) {}
   47   S3(const S3 &s3) : a(s3.a) {}
   48   S3 operator+(const S3 &arg1) { return arg1; }
   49 };
   50 int operator+(const S3 &arg1, const S3 &arg2) { return 5; }
   51 S3 c;               // expected-note 3 {{'c' defined here}}
   52 const S3 ca[5];     // expected-note 2 {{'ca' defined here}}
   53 extern const int f; // expected-note 4 {{'f' declared here}}
   54 class S4 {
   55   int a;
   56   S4(); // expected-note {{implicitly declared private here}}
   57   S4(const S4 &s4);
   58   S4 &operator+(const S4 &arg) { return (*this); }
   59 
   60 public:
   61   S4(int v) : a(v) {}
   62 };
   63 S4 &operator&=(S4 &arg1, S4 &arg2) { return arg1; }
   64 class S5 {
   65   int a;
   66   S5() : a(0) {} // expected-note {{implicitly declared private here}}
   67   S5(const S5 &s5) : a(s5.a) {}
   68   S5 &operator+(const S5 &arg);
   69 
   70 public:
   71   S5(int v) : a(v) {}
   72 };
   73 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}}
   74 #if __cplusplus >= 201103L // C++11 or later
   75 // expected-note@-2 3 {{candidate function (the implicit move assignment operator) not viable}}
   76 #endif
   77   int a;
   78 
   79 public:
   80   S6() : a(6) {}
   81   operator int() { return 6; }
   82 } o;
   83 
   84 S3 h, k;
   85 #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
   86 
   87 template <class T>       // expected-note {{declared here}}
   88 T tmain(T argc) {
   89   const T d = T();       // expected-note 4 {{'d' defined here}}
   90   const T da[5] = {T()}; // expected-note 2 {{'da' defined here}}
   91   T qa[5] = {T()};
   92   T i, z;
   93   T &j = i;                    // expected-note 4 {{'j' defined here}}
   94   S3 &p = k;                   // expected-note 2 {{'p' defined here}}
   95   const T &r = da[(int)i];     // expected-note 2 {{'r' defined here}}
   96   T &q = qa[(int)i];           // expected-note 2 {{'q' defined here}}
   97   T fl;
   98 #pragma omp target teams distribute simd reduction // expected-error {{expected '(' after 'reduction'}}
   99   for (int j=0; j<100; j++) foo();
  100 #pragma omp target teams distribute simd reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp target teams distribute simd' are ignored}}
  101   for (int j=0; j<100; j++) foo();
  102 #pragma omp target teams distribute simd reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
  103   for (int j=0; j<100; j++) foo();
  104 #pragma omp target teams distribute simd reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
  105   for (int j=0; j<100; j++) foo();
  106 #pragma omp target teams distribute simd reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
  107   for (int j=0; j<100; j++) foo();
  108 #pragma omp target teams distribute simd reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}}
  109   for (int j=0; j<100; j++) foo();
  110 #pragma omp target teams distribute simd reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
  111   for (int j=0; j<100; j++) foo();
  112 #pragma omp target teams distribute simd reduction(& : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{invalid operands to binary expression ('float' and 'float')}}
  113   for (int j=0; j<100; j++) foo();
  114 #pragma omp target teams distribute 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')}}
  115   for (int j=0; j<100; j++) foo();
  116 #pragma omp target teams distribute simd reduction(|| : argc ? i : argc) // expected-error 2 {{expected variable name, array element or array section}}
  117   for (int j=0; j<100; j++) foo();
  118 #pragma omp target teams distribute 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'}}
  119   for (int j=0; j<100; j++) foo();
  120 #pragma omp target teams distribute 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 '('}}
  121   for (int j=0; j<100; j++) foo();
  122 #pragma omp target teams distribute simd reduction(^ : T) // expected-error {{'T' does not refer to a value}}
  123   for (int j=0; j<100; j++) foo();
  124 #pragma omp target teams distribute simd 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'}}
  125   for (int j=0; j<100; j++) foo();
  126 #pragma omp target teams distribute simd reduction(min : z, 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}}
  127   for (int j=0; j<100; j++) foo();
  128 #pragma omp target teams distribute simd reduction(max : h.b) // expected-error {{expected variable name, array element or array section}}
  129   for (int j=0; j<100; j++) foo();
  130 #pragma omp target teams distribute simd reduction(+ : ba) // expected-error {{const-qualified variable cannot be reduction}}
  131   for (int j=0; j<100; j++) foo();
  132 #pragma omp target teams distribute simd reduction(* : ca) // expected-error {{const-qualified variable cannot be reduction}}
  133   for (int j=0; j<100; j++) foo();
  134 #pragma omp target teams distribute simd reduction(- : da) // expected-error {{const-qualified variable cannot be reduction}} expected-error {{const-qualified variable cannot be reduction}}
  135   for (int j=0; j<100; j++) foo();
  136 #pragma omp target teams distribute simd reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
  137   for (int j=0; j<100; j++) foo();
  138 #pragma omp target teams distribute simd reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
  139   for (int j=0; j<100; j++) foo();
  140 #pragma omp target teams distribute simd reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
  141   for (int j=0; j<100; j++) foo();
  142 #pragma omp target teams distribute simd reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}}
  143   for (int j=0; j<100; j++) foo();
  144 #pragma omp target teams distribute simd reduction(+ : o) // expected-error 2 {{no viable overloaded '='}}
  145   for (int j=0; j<100; j++) foo();
  146 #pragma omp target teams distribute simd private(i), reduction(+ : j), reduction(+ : q) // expected-error 4 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
  147   for (int j=0; j<100; j++) foo();
  148 #pragma omp parallel private(k)
  149 #pragma omp target teams distribute simd reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
  150   for (int j=0; j<100; j++) foo();
  151 #pragma omp target teams distribute simd reduction(+ : p), reduction(+ : p) // expected-error 2 {{variable can appear only once in OpenMP 'reduction' clause}} expected-note 2 {{previously referenced here}}
  152   for (int j=0; j<100; j++) foo();
  153 #pragma omp target teams distribute simd reduction(+ : r) // expected-error 2 {{const-qualified variable cannot be reduction}}
  154   for (int j=0; j<100; j++) foo();
  155 #pragma omp parallel shared(i)
  156 #pragma omp parallel reduction(min : i)
  157 #pragma omp target teams distribute simd reduction(max : j) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
  158   for (int j=0; j<100; j++) foo();
  159 #pragma omp target teams distribute simd reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute simd' directive}}
  160     for (int j=0; j<100; j++) foo();
  161 
  162   return T();
  163 }
  164 
  165 namespace A {
  166 double x;
  167 #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
  168 }
  169 namespace B {
  170 using A::x;
  171 }
  172 
  173 int main(int argc, char **argv) {
  174   const int d = 5;       // expected-note 2 {{'d' defined here}}
  175   const int da[5] = {0}; // expected-note {{'da' defined here}}
  176   int qa[5] = {0};
  177   S4 e(4);
  178   S5 g(5);
  179   int i, z;
  180   int &j = i;                  // expected-note 2 {{'j' defined here}}
  181   S3 &p = k;                   // expected-note 2 {{'p' defined here}}
  182   const int &r = da[i];        // expected-note {{'r' defined here}}
  183   int &q = qa[i];              // expected-note {{'q' defined here}}
  184   float fl;
  185 #pragma omp target teams distribute simd reduction // expected-error {{expected '(' after 'reduction'}}
  186   for (int j=0; j<100; j++) foo();
  187 #pragma omp target teams distribute simd reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp target teams distribute simd' are ignored}}
  188   for (int j=0; j<100; j++) foo();
  189 #pragma omp target teams distribute simd reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
  190   for (int j=0; j<100; j++) foo();
  191 #pragma omp target teams distribute simd reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
  192   for (int j=0; j<100; j++) foo();
  193 #pragma omp target teams distribute simd reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
  194   for (int j=0; j<100; j++) foo();
  195 #pragma omp target teams distribute simd reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}}
  196   for (int j=0; j<100; j++) foo();
  197 #pragma omp target teams distribute simd reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
  198   for (int j=0; j<100; j++) foo();
  199 #pragma omp target teams distribute simd reduction(foo : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max'}}
  200   for (int j=0; j<100; j++) foo();
  201 #pragma omp target teams distribute simd reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
  202   for (int j=0; j<100; j++) foo();
  203 #pragma omp target teams distribute simd reduction(|| : argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name, array element or array section}}
  204   for (int j=0; j<100; j++) foo();
  205 #pragma omp target teams distribute simd reduction(~ : argc) // expected-error {{expected unqualified-id}}
  206   for (int j=0; j<100; j++) foo();
  207 #pragma omp target teams distribute simd reduction(&& : argc)
  208   for (int j=0; j<100; j++) foo();
  209 #pragma omp target teams distribute simd reduction(^ : S1) // expected-error {{'S1' does not refer to a value}}
  210   for (int j=0; j<100; j++) foo();
  211 #pragma omp target teams distribute 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'}}
  212   for (int j=0; j<100; j++) foo();
  213 #pragma omp target teams distribute 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}}
  214   for (int j=0; j<100; j++) foo();
  215 #pragma omp target teams distribute simd reduction(max : h.b) // expected-error {{expected variable name, array element or array section}}
  216   for (int j=0; j<100; j++) foo();
  217 #pragma omp target teams distribute simd reduction(+ : ba) // expected-error {{const-qualified variable cannot be reduction}}
  218   for (int j=0; j<100; j++) foo();
  219 #pragma omp target teams distribute simd reduction(* : ca, z) // expected-error {{const-qualified variable cannot be reduction}}
  220   for (int j=0; j<100; j++) foo();
  221 #pragma omp target teams distribute simd reduction(- : da) // expected-error {{const-qualified variable cannot be reduction}}
  222   for (int j=0; j<100; j++) foo();
  223 #pragma omp target teams distribute simd reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
  224   for (int j=0; j<100; j++) foo();
  225 #pragma omp target teams distribute simd reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
  226   for (int j=0; j<100; j++) foo();
  227 #pragma omp target teams distribute simd reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
  228   for (int j=0; j<100; j++) foo();
  229 #pragma omp target teams distribute 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')}}
  230   for (int j=0; j<100; j++) foo();
  231 #pragma omp target teams distribute simd reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}}
  232   for (int j=0; j<100; j++) foo();
  233 #pragma omp target teams distribute simd reduction(+ : o) // expected-error {{no viable overloaded '='}}
  234   for (int j=0; j<100; j++) foo();
  235 #pragma omp target teams distribute simd private(i), reduction(+ : j), reduction(+ : q) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
  236   for (int j=0; j<100; j++) foo();
  237 #pragma omp parallel private(k)
  238 #pragma omp target teams distribute simd reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
  239   for (int j=0; j<100; j++) foo();
  240 #pragma omp target teams distribute simd reduction(+ : p), reduction(+ : p) // expected-error {{variable can appear only once in OpenMP 'reduction' clause}} expected-note {{previously referenced here}}
  241   for (int j=0; j<100; j++) foo();
  242 #pragma omp target teams distribute simd reduction(+ : r) // expected-error {{const-qualified variable cannot be reduction}}
  243   for (int j=0; j<100; j++) foo();
  244 #pragma omp parallel shared(i)
  245 #pragma omp parallel reduction(min : i)
  246 #pragma omp target teams distribute simd reduction(max : j) // expected-error {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
  247   for (int j=0; j<100; j++) foo();
  248 #pragma omp target teams distribute simd reduction(+ : fl)
  249     for (int j=0; j<100; j++) foo();
  250   static int m;
  251 #pragma omp target teams distribute simd reduction(+ : m) // OK
  252   for (int j=0; j<100; j++) foo();
  253 
  254   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}}
  255 }