brintos

brintos / llvm-project-archived public Read only

0
0
Text · 10.5 KiB · 7137f5d Raw
273 lines · cpp
1// RUN: %clang_cc1 -std=c++11 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -ferror-limit 200 %s -Wuninitialized2// RUN: %clang_cc1 -std=c++11 -verify=expected,omp50 -fopenmp -ferror-limit 200 %s -Wuninitialized3 4// RUN: %clang_cc1 -std=c++11 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -ferror-limit 200 %s -Wuninitialized5// RUN: %clang_cc1 -std=c++11 -verify=expected,omp50 -fopenmp-simd -ferror-limit 200 %s -Wuninitialized6struct ST {7  int *a;8};9typedef int arr[10];10typedef ST STarr[10];11struct SA {12  const int d = 5;13  const int da[5] = { 0 };14  ST e;15  ST g[10];16  STarr &rg = g;17  int i;18  int &j = i;19  int *k = &j;20  int *&z = k;21  int aa[10];22  arr &raa = aa;23  void func(int arg) {24#pragma omp target is_device_ptr // expected-error {{expected '(' after 'is_device_ptr'}}25    {}26#pragma omp target is_device_ptr( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}27    {}28#pragma omp target is_device_ptr() // expected-error {{expected expression}}29    {}30#pragma omp target is_device_ptr(alloc) // expected-error {{use of undeclared identifier 'alloc'}}31    {}32#pragma omp target is_device_ptr(arg // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}33    {}34#pragma omp target is_device_ptr(i) // expected-error {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}35    {}36#pragma omp target is_device_ptr(j) // expected-error {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}37    {}38#pragma omp target is_device_ptr(k) // OK39    {}40#pragma omp target is_device_ptr(z) // OK41    {}42#pragma omp target is_device_ptr(aa) // OK43    {}44#pragma omp target is_device_ptr(raa) // OK45    {}46#pragma omp target is_device_ptr(e) // expected-error{{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}47    {}48#pragma omp target is_device_ptr(g) // OK49    {}50#pragma omp target is_device_ptr(rg) // OK51    {}52#pragma omp target is_device_ptr(k,i,j) // expected-error2 {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}53    {}54#pragma omp target is_device_ptr(d) // expected-error{{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}55    {}56#pragma omp target is_device_ptr(da) // OK57    {}58  return;59 }60};61struct SB {62  unsigned A;63  unsigned B;64  float Arr[100];65  float *Ptr;66  float *foo() {67    return &Arr[0];68  }69};70 71struct SC {72  unsigned A : 2;73  unsigned B : 3;74  unsigned C;75  unsigned D;76  float Arr[100];77  SB S;78  SB ArrS[100];79  SB *PtrS;80  SB *&RPtrS;81  float *Ptr;82 83  SC(SB *&_RPtrS) : RPtrS(_RPtrS) {}84};85 86union SD {87  unsigned A;88  float B;89};90 91struct S1;92extern S1 a;93class S2 {94  mutable int a;95public:96  S2():a(0) { }97  S2(S2 &s2):a(s2.a) { }98  static float S2s;99  static const float S2sc;100};101const float S2::S2sc = 0;102const S2 b;103const S2 ba[5];104class S3 {105  int a;106public:107  S3():a(0) { }108  S3(S3 &s3):a(s3.a) { }109};110const S3 c;111const S3 ca[5];112extern const int f;113class S4 {114  int a;115  S4();116  S4(const S4 &s4);117public:118  S4(int v):a(v) { }119};120class S5 {121  int a;122  S5():a(0) {}123  S5(const S5 &s5):a(s5.a) { }124public:125  S5(int v):a(v) { }126};127 128S3 h;129#pragma omp threadprivate(h)130 131typedef struct {132  int a;133} S6;134 135template <typename T, int I>136T tmain(T argc) {137  const T d = 5;138  const T da[5] = { 0 };139  S4 e(4);140  S5 g(5);141  S6 h[10];142  auto &rh = h;143  T i;144  T &j = i;145  T *k = &j;146  T *&z = k;147  T aa[10];148  auto &raa = aa;149  S6 *ps;150#pragma omp target is_device_ptr // expected-error {{expected '(' after 'is_device_ptr'}}151  {}152#pragma omp target is_device_ptr( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}153  {}154#pragma omp target is_device_ptr() // expected-error {{expected expression}}155  {}156#pragma omp target is_device_ptr(alloc) // expected-error {{use of undeclared identifier 'alloc'}}157  {}158#pragma omp target is_device_ptr(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error{{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}159  {}160#pragma omp target is_device_ptr(i) // expected-error {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}161  {}162#pragma omp target is_device_ptr(j) // expected-error {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}163  {}164#pragma omp target is_device_ptr(k) // OK165  {}166#pragma omp target is_device_ptr(z) // OK167  {}168#pragma omp target is_device_ptr(aa) // OK169  {}170#pragma omp target is_device_ptr(raa) // OK171  {}172#pragma omp target is_device_ptr(e) // expected-error{{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}173  {}174#pragma omp target is_device_ptr(g) // expected-error{{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}175  {}176#pragma omp target is_device_ptr(h) // OK177  {}178#pragma omp target is_device_ptr(rh) // OK179  {}180#pragma omp target is_device_ptr(k,i,j) // expected-error2 {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}181  {}182#pragma omp target is_device_ptr(d) // expected-error{{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}183  {}184#pragma omp target is_device_ptr(da) // OK185  {}186#pragma omp target map(ps) is_device_ptr(ps) // expected-error{{variable already marked as mapped in current construct}} expected-note{{used here}}187  {}188#pragma omp target is_device_ptr(ps) map(ps) // expected-error{{variable already marked as mapped in current construct}} expected-note{{used here}}189  {}190#pragma omp target map(ps->a) is_device_ptr(ps) // expected-error{{variable already marked as mapped in current construct}} expected-note{{used here}}191  {}192#pragma omp target is_device_ptr(ps) map(ps->a) // expected-error{{pointer cannot be mapped along with a section derived from itself}} expected-note{{used here}}193  {}194#pragma omp target is_device_ptr(ps) firstprivate(ps) // expected-error{{firstprivate variable cannot be in a is_device_ptr clause in '#pragma omp target' directive}}195  {}196#pragma omp target firstprivate(ps) is_device_ptr(ps) // expected-error{{firstprivate variable cannot be in a is_device_ptr clause in '#pragma omp target' directive}} expected-note{{defined as firstprivate}}197  {}198#pragma omp target is_device_ptr(ps) private(ps) // expected-error{{private variable cannot be in a is_device_ptr clause in '#pragma omp target' directive}}199  {}200#pragma omp target private(ps) is_device_ptr(ps) // expected-error{{private variable cannot be in a is_device_ptr clause in '#pragma omp target' directive}} expected-note{{defined as private}}201  {}202  return 0;203}204 205int main(int argc, char **argv) {206  const int d = 5;207  const int da[5] = { 0 };208  S4 e(4);209  S5 g(5);210  S6 h[10];211  auto &rh = h;212  int i;213  int &j = i;214  int *k = &j;215  int *&z = k;216  int aa[10];217  auto &raa = aa;218  S6 *ps;219#pragma omp target is_device_ptr // expected-error {{expected '(' after 'is_device_ptr'}}220  {}221#pragma omp target is_device_ptr( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}222  {}223#pragma omp target is_device_ptr() // expected-error {{expected expression}}224  {}225#pragma omp target is_device_ptr(alloc) // expected-error {{use of undeclared identifier 'alloc'}}226  {}227#pragma omp target is_device_ptr(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}228  {}229#pragma omp target is_device_ptr(i) // expected-error {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}230  {}231#pragma omp target is_device_ptr(j) // expected-error {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}232  {}233#pragma omp target is_device_ptr(k) // OK234  {}235#pragma omp target is_device_ptr(z) // OK236  {}237#pragma omp target is_device_ptr(aa) // OK238  {}239#pragma omp target is_device_ptr(raa) // OK240  {}241#pragma omp target is_device_ptr(e) // expected-error{{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}242  {}243#pragma omp target is_device_ptr(g) // expected-error{{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}244  {}245#pragma omp target is_device_ptr(h) // OK246  {}247#pragma omp target is_device_ptr(rh) // OK248  {}249#pragma omp target is_device_ptr(k,i,j) // expected-error2 {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}250  {}251#pragma omp target is_device_ptr(d) // expected-error{{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}252  {}253#pragma omp target is_device_ptr(da) // OK254  {}255#pragma omp target map(ps) is_device_ptr(ps) // expected-error{{variable already marked as mapped in current construct}} expected-note{{used here}}256  {}257#pragma omp target is_device_ptr(ps) map(ps) // expected-error{{variable already marked as mapped in current construct}} expected-note{{used here}}258  {}259#pragma omp target map(ps->a) is_device_ptr(ps) // expected-error{{variable already marked as mapped in current construct}} expected-note{{used here}}260  {}261#pragma omp target is_device_ptr(ps) map(ps->a) // expected-error{{pointer cannot be mapped along with a section derived from itself}} expected-note{{used here}}262  {}263#pragma omp target is_device_ptr(ps) firstprivate(ps) // expected-error{{firstprivate variable cannot be in a is_device_ptr clause in '#pragma omp target' directive}}264  {}265#pragma omp target firstprivate(ps) is_device_ptr(ps) // expected-error{{firstprivate variable cannot be in a is_device_ptr clause in '#pragma omp target' directive}} expected-note{{defined as firstprivate}}266  {}267#pragma omp target is_device_ptr(ps) private(ps) // expected-error{{private variable cannot be in a is_device_ptr clause in '#pragma omp target' directive}}268  {}269#pragma omp target private(ps) is_device_ptr(ps) // expected-error{{private variable cannot be in a is_device_ptr clause in '#pragma omp target' directive}} expected-note{{defined as private}}270  {}271  return tmain<int, 3>(argc); // expected-note {{in instantiation of function template specialization 'tmain<int, 3>' requested here}}272}273