brintos

brintos / llvm-project-archived public Read only

0
0
Text · 9.1 KiB · bac6fc0 Raw
290 lines · cpp
1// RUN: %clang_cc1 -std=c++11 -verify \2// RUN:  -fopenmp -ferror-limit 200 %s -Wuninitialized3 4// RUN: %clang_cc1 -std=c++11 -verify \5// RUN:  -fopenmp-simd -ferror-limit 200 %s -Wuninitialized6 7// RUN: %clang_cc1 -std=c++11 -verify \8// RUN:  -fopenmp -fopenmp-version=60 -ferror-limit 200 %s -Wuninitialized9 10// RUN: %clang_cc1 -std=c++11 -verify \11// RUN:  -fopenmp-simd -fopenmp-version=60 -ferror-limit 200 %s -Wuninitialized12 13struct ST {14  int *a;15};16 17typedef int arr[10];18typedef ST STarr[10];19struct SA {20  const int d = 5;21  const int da[5] = { 0 };22  ST e;23  ST g[10];24  STarr &rg = g;25  int i;26  int &j = i;27  int *k = &j;28  int *&z = k;29  int aa[10];30  arr &raa = aa;31  void func(int arg) {32#pragma omp target has_device_addr // expected-error {{expected '(' after 'has_device_addr'}}33    {}34#pragma omp target has_device_addr( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}35    {}36#pragma omp target has_device_addr() // expected-error {{expected expression}}37    {}38#pragma omp target has_device_addr(alloc) // expected-error {{use of undeclared identifier 'alloc'}}39    {}40#pragma omp target has_device_addr(arg // expected-error {{expected ')'}} expected-note {{to match this '('}}41    {}42#pragma omp target has_device_addr(i) // OK43    {}44#pragma omp target has_device_addr(j) // OK45    {}46#pragma omp target has_device_addr(k) // OK47    {}48#pragma omp target has_device_addr(z) // OK49    {}50#pragma omp target has_device_addr(aa) // OK51    {}52#pragma omp target has_device_addr(raa) // OK53    {}54#pragma omp target has_device_addr(e) // OK55    {}56#pragma omp target has_device_addr(g) // OK57    {}58#pragma omp target has_device_addr(rg) // OK59    {}60#pragma omp target has_device_addr(k,i,j) // OK61    {}62#pragma omp target has_device_addr(d) // OK63    {}64#pragma omp target has_device_addr(da) // OK65    {}66  return;67 }68};69struct SB {70  unsigned A;71  unsigned B;72  float Arr[100];73  float *Ptr;74  float *foo() {75    return &Arr[0];76  }77};78 79struct SC {80  unsigned A : 2;81  unsigned B : 3;82  unsigned C;83  unsigned D;84  float Arr[100];85  SB S;86  SB ArrS[100];87  SB *PtrS;88  SB *&RPtrS;89  float *Ptr;90 91  SC(SB *&_RPtrS) : RPtrS(_RPtrS) {}92};93 94union SD {95  unsigned A;96  float B;97};98 99struct S1;100extern S1 a;101class S2 {102  mutable int a;103public:104  S2():a(0) { }105  S2(S2 &s2):a(s2.a) { }106  static float S2s;107  static const float S2sc;108};109const float S2::S2sc = 0;110const S2 b;111const S2 ba[5];112class S3 {113  int a;114public:115  S3():a(0) { }116  S3(S3 &s3):a(s3.a) { }117};118const S3 c;119const S3 ca[5];120extern const int f;121class S4 {122  int a;123  S4();124  S4(const S4 &s4);125public:126  S4(int v):a(v) { }127};128class S5 {129  int a;130  S5():a(0) {}131  S5(const S5 &s5):a(s5.a) { }132public:133  S5(int v):a(v) { }134};135 136S3 h;137#pragma omp threadprivate(h)138 139typedef struct {140  int a;141} S6;142 143template <typename T, typename S, int I>144T tfoo(T argc, S ub[]) {145  const T d = I;146  const T da[5] = { 0 };147  S4 e(4);148  S5 g(5);149  S6 h[10];150  auto &rh = h;151  T i;152  T &j = i;153  T *k = &j;154  T *&z = k;155  T aa[10];156  auto &raa = aa;157  S6 *ps;158#pragma omp target has_device_addr // expected-error {{expected '(' after 'has_device_addr'}}159  {}160#pragma omp target has_device_addr( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}161  {}162#pragma omp target has_device_addr() // expected-error {{expected expression}}163  {}164#pragma omp target has_device_addr(alloc) // expected-error {{use of undeclared identifier 'alloc'}}165  {}166#pragma omp target has_device_addr(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}167  {}168#pragma omp target has_device_addr(i) // OK169  {}170#pragma omp target has_device_addr(j) // OK171  {}172#pragma omp target has_device_addr(k) // OK173  {}174#pragma omp target has_device_addr(z) // OK175  {}176#pragma omp target has_device_addr(aa) // OK177  {}178#pragma omp target has_device_addr(raa) // OK179  {}180#pragma omp target has_device_addr(e) // OK181  {}182#pragma omp target has_device_addr(g) // OK183  {}184#pragma omp target has_device_addr(h) // OK185  {}186#pragma omp target has_device_addr(rh) // OK187  {}188#pragma omp target has_device_addr(k,i,j) // OK189  {}190#pragma omp target has_device_addr(d) // OK191  {}192#pragma omp target has_device_addr(da) // OK193  {}194#pragma omp target map(ps) has_device_addr(ps) // expected-error{{variable already marked as mapped in current construct}} expected-note{{used here}}195  {}196#pragma omp target has_device_addr(ps) map(ps) // expected-error{{variable already marked as mapped in current construct}} expected-note{{used here}}197  {}198#pragma omp target map(ps->a) has_device_addr(ps) // expected-error{{variable already marked as mapped in current construct}} expected-note{{used here}}199  {}200#pragma omp target has_device_addr(ps) map(ps->a) // expected-error{{pointer cannot be mapped along with a section derived from itself}} expected-note{{used here}}201  {}202#pragma omp target has_device_addr(ps) firstprivate(ps) // expected-error{{firstprivate variable cannot be in a has_device_addr clause in '#pragma omp target' directive}}203  {}204#pragma omp target firstprivate(ps) has_device_addr(ps) // expected-error{{firstprivate variable cannot be in a has_device_addr clause in '#pragma omp target' directive}} expected-note{{defined as firstprivate}}205  {}206#pragma omp target has_device_addr(ps) private(ps) // expected-error{{private variable cannot be in a has_device_addr clause in '#pragma omp target' directive}}207  {}208#pragma omp target private(ps) has_device_addr(ps) // expected-error{{private variable cannot be in a has_device_addr clause in '#pragma omp target' directive}} expected-note{{defined as private}}209  {}210#pragma omp target has_device_addr(ps[:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}211  {}212#pragma omp target has_device_addr(ub[:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is an array of unknown bound}}213  {}214  return 0;215}216 217int foo(int argc, float ub[]) {218  const int d = 5;219  const int da[5] = { 0 };220  S4 e(4);221  S5 g(5);222  S6 h[10];223  auto &rh = h;224  int i;225  int &j = i;226  int *k = &j;227  int *&z = k;228  int aa[10];229  auto &raa = aa;230  S6 *ps;231#pragma omp target has_device_addr // expected-error {{expected '(' after 'has_device_addr'}}232  {}233#pragma omp target has_device_addr( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}234  {}235#pragma omp target has_device_addr() // expected-error {{expected expression}}236  {}237#pragma omp target has_device_addr(alloc) // expected-error {{use of undeclared identifier 'alloc'}}238  {}239#pragma omp target has_device_addr(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}240  {}241#pragma omp target has_device_addr(i) // OK242  {}243#pragma omp target has_device_addr(j) // OK244  {}245#pragma omp target has_device_addr(k) // OK246  {}247#pragma omp target has_device_addr(z) // OK248  {}249#pragma omp target has_device_addr(aa) // OK250  {}251#pragma omp target has_device_addr(raa) // OK252  {}253#pragma omp target has_device_addr(e) // OK254  {}255#pragma omp target has_device_addr(g) // OK256  {}257#pragma omp target has_device_addr(h) // OK258  {}259#pragma omp target has_device_addr(rh) // OK260  {}261#pragma omp target has_device_addr(k,i,j) // OK262  {}263#pragma omp target has_device_addr(d) // OK264  {}265#pragma omp target has_device_addr(da) // OK266  {}267#pragma omp target map(ps) has_device_addr(ps) // expected-error{{variable already marked as mapped in current construct}} expected-note{{used here}}268  {}269#pragma omp target has_device_addr(ps) map(ps) // expected-error{{variable already marked as mapped in current construct}} expected-note{{used here}}270  {}271#pragma omp target map(ps->a) has_device_addr(ps) // expected-error{{variable already marked as mapped in current construct}} expected-note{{used here}}272  {}273#pragma omp target has_device_addr(ps) map(ps->a) // expected-error{{pointer cannot be mapped along with a section derived from itself}} expected-note{{used here}}274  {}275#pragma omp target has_device_addr(ps) firstprivate(ps) // expected-error{{firstprivate variable cannot be in a has_device_addr clause in '#pragma omp target' directive}}276  {}277#pragma omp target firstprivate(ps) has_device_addr(ps) // expected-error{{firstprivate variable cannot be in a has_device_addr clause in '#pragma omp target' directive}} expected-note{{defined as firstprivate}}278  {}279#pragma omp target has_device_addr(ps) private(ps) // expected-error{{private variable cannot be in a has_device_addr clause in '#pragma omp target' directive}}280  {}281#pragma omp target private(ps) has_device_addr(ps) // expected-error{{private variable cannot be in a has_device_addr clause in '#pragma omp target' directive}} expected-note{{defined as private}}282  {}283#pragma omp target has_device_addr(ps[:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}284  {}285#pragma omp target has_device_addr(ub[:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is an array of unknown bound}}286  {}287  return tfoo<int, float, 5>(argc, ub); // expected-note {{in instantiation of function template specialization 'tfoo<int, float, 5>' requested here}}288 289}290