| 1 |
// RUN: %clang_cc1 -verify=expected,ge45,ge50,lt51 -fopenmp -fno-openmp-extensions -ferror-limit 200 %s -Wno-openmp-mapping -Wuninitialized -Wno-vla |
| 2 |
// RUN: %clang_cc1 -verify=expected,lt45,lt50,lt51 -fopenmp -fno-openmp-extensions -fopenmp-version=40 -ferror-limit 200 %s -Wno-openmp-mapping -Wuninitialized -Wno-vla |
| 3 |
// RUN: %clang_cc1 -verify=expected,ge45,lt50,lt51 -fopenmp -fno-openmp-extensions -fopenmp-version=45 -ferror-limit 200 %s -Wno-openmp-mapping -Wuninitialized -Wno-vla |
| 4 |
// RUN: %clang_cc1 -verify=expected,ge45,ge50,lt51 -fopenmp -fno-openmp-extensions -fopenmp-version=50 -ferror-limit 200 %s -Wno-openmp-mapping -Wuninitialized -Wno-vla |
| 5 |
// RUN: %clang_cc1 -verify=expected,ge45,ge50,ge51 -fopenmp -fno-openmp-extensions -ferror-limit 200 %s -Wno-openmp-mapping -Wuninitialized -Wno-vla |
| 6 |
// RUN: %clang_cc1 -verify=expected,ge45,ge50,lt51 -fopenmp-simd -fno-openmp-extensions -ferror-limit 200 %s -Wno-openmp-mapping -Wuninitialized -Wno-vla |
| 7 |
// RUN: %clang_cc1 -DCCODE -verify=expected,ge45,ge50,lt51 -fopenmp -fno-openmp-extensions -ferror-limit 200 -x c %s -Wno-openmp-mapping -Wuninitialized -Wno-vla |
| 8 |
// RUN: %clang_cc1 -verify=expected,ge45,ge50,lt51,omp52 -fopenmp -fno-openmp-extensions -fopenmp-version=52 -ferror-limit 200 %s -Wno-openmp-mapping -Wuninitialized |
| 9 |
#ifdef CCODE |
| 10 |
void foo(int arg) { |
| 11 |
const int n = 0; |
| 12 |
|
| 13 |
double marr[10][10][10]; |
| 14 |
|
| 15 |
#pragma omp target teams map(marr[2][0:2][0:2]) // expected-error {{array section does not specify contiguous storage}} |
| 16 |
{} |
| 17 |
#pragma omp target teams map(marr[:][0:][:]) |
| 18 |
{} |
| 19 |
#pragma omp target teams map(marr[:][1:][:]) // expected-error {{array section does not specify contiguous storage}} |
| 20 |
{} |
| 21 |
#pragma omp target teams map(marr[:][n:][:]) |
| 22 |
{} |
| 23 |
} |
| 24 |
#else |
| 25 |
|
| 26 |
void xxx(int argc) { |
| 27 |
int map; // expected-note {{initialize the variable 'map' to silence this warning}} |
| 28 |
#pragma omp target teams map(tofrom: map) // expected-warning {{variable 'map' is uninitialized when used here}} |
| 29 |
for (int i = 0; i < 10; ++i) |
| 30 |
; |
| 31 |
} |
| 32 |
|
| 33 |
template <typename T, int I> |
| 34 |
struct SA { |
| 35 |
static int ss; |
| 36 |
#pragma omp threadprivate(ss) // expected-note {{defined as threadprivate or thread local}} |
| 37 |
float a; |
| 38 |
int b[12]; |
| 39 |
float *c; |
| 40 |
T d; |
| 41 |
float e[I]; |
| 42 |
T *f; |
| 43 |
void func(int arg) { |
| 44 |
#pragma omp target teams map(arg,a,d) |
| 45 |
{} |
| 46 |
#pragma omp target teams map(arg[2:2],a,d) // expected-error {{subscripted value is not an array or pointer}} |
| 47 |
{} |
| 48 |
// ge50-error@+2 {{expected addressable lvalue in 'map' clause}} |
| 49 |
// lt50-error@+1 {{expected expression containing only member accesses and/or array sections based on named variables}} |
| 50 |
#pragma omp target teams map(arg,a*2) |
| 51 |
{} |
| 52 |
// lt50-error@+1 {{expected expression containing only member accesses and/or array sections based on named variables}} |
| 53 |
#pragma omp target teams map(arg,(c+1)[2]) |
| 54 |
{} |
| 55 |
#pragma omp target teams map(arg,a[:2],d) // expected-error {{subscripted value is not an array or pointer}} |
| 56 |
{} |
| 57 |
#pragma omp target teams map(arg,a,d[:2]) // expected-error {{subscripted value is not an array or pointer}} |
| 58 |
{} |
| 59 |
|
| 60 |
#pragma omp target teams map(to:ss) // expected-error {{threadprivate variables are not allowed in 'map' clause}} |
| 61 |
{} |
| 62 |
|
| 63 |
#pragma omp target teams map(to:b,e) |
| 64 |
{} |
| 65 |
#pragma omp target teams map(to:b,e) map(to:b) // lt50-error {{variable already marked as mapped in current construct}} lt50-note {{used here}} |
| 66 |
{} |
| 67 |
#pragma omp target teams map(to:b[:2],e) |
| 68 |
{} |
| 69 |
#pragma omp target teams map(to:b,e[:]) |
| 70 |
{} |
| 71 |
#pragma omp target teams map(b[-1:]) // expected-error {{array section must be a subset of the original array}} |
| 72 |
{} |
| 73 |
#pragma omp target teams map(b[:-1]) // expected-error {{section length is evaluated to a negative value -1}} |
| 74 |
{} |
| 75 |
#pragma omp target teams map(b[true:true]) |
| 76 |
{} |
| 77 |
|
| 78 |
#pragma omp target teams map(always, tofrom: c,f) |
| 79 |
{} |
| 80 |
#pragma omp target teams map(always, tofrom: c[1:2],f) |
| 81 |
{} |
| 82 |
#pragma omp target teams map(always, tofrom: c,f[1:2]) |
| 83 |
{} |
| 84 |
#pragma omp target teams map(always, tofrom: c[:],f) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}} |
| 85 |
{} |
| 86 |
#pragma omp target teams map(always, tofrom: c,f[:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}} |
| 87 |
{} |
| 88 |
#pragma omp target teams map(always tofrom: c) // omp52-error {{missing ',' after map type modifier}} |
| 89 |
{} |
| 90 |
return; |
| 91 |
} |
| 92 |
}; |
| 93 |
|
| 94 |
struct SB { |
| 95 |
unsigned A; |
| 96 |
unsigned B; |
| 97 |
float Arr[100]; |
| 98 |
float *Ptr; |
| 99 |
float *foo() { |
| 100 |
return &Arr[0]; |
| 101 |
} |
| 102 |
}; |
| 103 |
|
| 104 |
struct SC { |
| 105 |
unsigned A : 2; |
| 106 |
unsigned B : 3; |
| 107 |
unsigned C; |
| 108 |
unsigned D; |
| 109 |
float Arr[100]; |
| 110 |
SB S; |
| 111 |
SB ArrS[100]; |
| 112 |
SB *PtrS; |
| 113 |
SB *&RPtrS; |
| 114 |
float *Ptr; |
| 115 |
|
| 116 |
SC(SB *&_RPtrS) : RPtrS(_RPtrS) {} |
| 117 |
}; |
| 118 |
|
| 119 |
union SD { |
| 120 |
unsigned A; |
| 121 |
float B; |
| 122 |
}; |
| 123 |
|
| 124 |
void SAclient(int arg) { |
| 125 |
SA<int,123> s; |
| 126 |
s.func(arg); // expected-note {{in instantiation of member function}} |
| 127 |
double marr[10][10][10]; |
| 128 |
double marr2[5][10][1]; |
| 129 |
double mvla[5][arg][10]; |
| 130 |
double ***mptr; |
| 131 |
const int n = 0; |
| 132 |
const int m = 1; |
| 133 |
double mvla2[5][arg][m+n+10]; |
| 134 |
|
| 135 |
SB *p; |
| 136 |
|
| 137 |
SD u; |
| 138 |
SC r(p),t(p); |
| 139 |
#pragma omp target teams map(r) |
| 140 |
{} |
| 141 |
#pragma omp target teams map(marr[2][0:2][0:2]) // expected-error {{array section does not specify contiguous storage}} |
| 142 |
{} |
| 143 |
#pragma omp target teams map(marr[:][0:2][0:2]) // expected-error {{array section does not specify contiguous storage}} |
| 144 |
{} |
| 145 |
#pragma omp target teams map(marr[2][3][0:2]) |
| 146 |
{} |
| 147 |
#pragma omp target teams map(marr[:][:][:]) |
| 148 |
{} |
| 149 |
#pragma omp target teams map(marr[:2][:][:]) |
| 150 |
{} |
| 151 |
#pragma omp target teams map(marr[arg:][:][:]) |
| 152 |
{} |
| 153 |
#pragma omp target teams map(marr[arg:]) |
| 154 |
{} |
| 155 |
#pragma omp target teams map(marr[arg:][:arg][:]) // correct if arg is the size of dimension 2 |
| 156 |
{} |
| 157 |
#pragma omp target teams map(marr[:arg][:]) |
| 158 |
{} |
| 159 |
#pragma omp target teams map(marr[:arg][n:]) |
| 160 |
{} |
| 161 |
#pragma omp target teams map(marr[:][:arg][n:]) // correct if arg is the size of dimension 2 |
| 162 |
{} |
| 163 |
#pragma omp target teams map(marr[:][:m][n:]) // expected-error {{array section does not specify contiguous storage}} |
| 164 |
{} |
| 165 |
#pragma omp target teams map(marr[n:m][:arg][n:]) |
| 166 |
{} |
| 167 |
#pragma omp target teams map(marr[:2][:1][:]) // expected-error {{array section does not specify contiguous storage}} |
| 168 |
{} |
| 169 |
#pragma omp target teams map(marr[:2][1:][:]) // expected-error {{array section does not specify contiguous storage}} |
| 170 |
{} |
| 171 |
#pragma omp target teams map(marr[:2][:][:1]) // expected-error {{array section does not specify contiguous storage}} |
| 172 |
{} |
| 173 |
#pragma omp target teams map(marr[:2][:][1:]) // expected-error {{array section does not specify contiguous storage}} |
| 174 |
{} |
| 175 |
#pragma omp target teams map(marr[:1][:2][:]) |
| 176 |
{} |
| 177 |
#pragma omp target teams map(marr[:1][0][:]) |
| 178 |
{} |
| 179 |
#pragma omp target teams map(marr[:arg][:2][:]) // correct if arg is 1 |
| 180 |
{} |
| 181 |
#pragma omp target teams map(marr[:1][3:1][:2]) |
| 182 |
{} |
| 183 |
#pragma omp target teams map(marr[:1][3:arg][:2]) // correct if arg is 1 |
| 184 |
{} |
| 185 |
#pragma omp target teams map(marr[:1][3:2][:2]) // expected-error {{array section does not specify contiguous storage}} |
| 186 |
{} |
| 187 |
#pragma omp target teams map(marr[:2][:10][:]) |
| 188 |
{} |
| 189 |
#pragma omp target teams map(marr[:2][:][:5+5]) |
| 190 |
{} |
| 191 |
#pragma omp target teams map(marr[:2][2+2-4:][0:5+5]) |
| 192 |
{} |
| 193 |
|
| 194 |
#pragma omp target teams map(marr[:1][:2][0]) // expected-error {{array section does not specify contiguous storage}} |
| 195 |
{} |
| 196 |
#pragma omp target teams map(marr2[:1][:2][0]) |
| 197 |
{} |
| 198 |
|
| 199 |
#pragma omp target teams map(mvla[:1][:][0]) // correct if the size of dimension 2 is 1. |
| 200 |
{} |
| 201 |
#pragma omp target teams map(mvla[:2][:arg][:]) // correct if arg is the size of dimension 2. |
| 202 |
{} |
| 203 |
#pragma omp target teams map(mvla[:1][:2][0]) // expected-error {{array section does not specify contiguous storage}} |
| 204 |
{} |
| 205 |
#pragma omp target teams map(mvla[1][2:arg][:]) |
| 206 |
{} |
| 207 |
#pragma omp target teams map(mvla[:1][:][:]) |
| 208 |
{} |
| 209 |
#pragma omp target teams map(mvla2[:1][:2][:11]) |
| 210 |
{} |
| 211 |
#pragma omp target teams map(mvla2[:1][:2][:10]) // expected-error {{array section does not specify contiguous storage}} |
| 212 |
{} |
| 213 |
|
| 214 |
#pragma omp target teams map(mptr[:2][2+2-4:1][0:5+5]) // expected-error {{array section does not specify contiguous storage}} |
| 215 |
{} |
| 216 |
#pragma omp target teams map(mptr[:1][:2-1][2:4-3]) |
| 217 |
{} |
| 218 |
#pragma omp target teams map(mptr[:1][:arg][2:4-3]) // correct if arg is 1. |
| 219 |
{} |
| 220 |
#pragma omp target teams map(mptr[:1][:2-1][0:2]) |
| 221 |
{} |
| 222 |
#pragma omp target teams map(mptr[:1][:2][0:2]) // expected-error {{array section does not specify contiguous storage}} |
| 223 |
{} |
| 224 |
#pragma omp target teams map(mptr[:1][:][0:2]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}} |
| 225 |
{} |
| 226 |
#pragma omp target teams map(mptr[:2][:1][0:2]) // expected-error {{array section does not specify contiguous storage}} |
| 227 |
{} |
| 228 |
|
| 229 |
#pragma omp target teams map(r.ArrS[0].B) |
| 230 |
{} |
| 231 |
#pragma omp target teams map(r.ArrS[:1].B) // expected-error {{OpenMP array section is not allowed here}} |
| 232 |
{} |
| 233 |
#pragma omp target teams map(r.ArrS[:arg].B) // expected-error {{OpenMP array section is not allowed here}} |
| 234 |
{} |
| 235 |
#pragma omp target teams map(r.ArrS[0].Arr[1:23]) |
| 236 |
{} |
| 237 |
#pragma omp target teams map(r.ArrS[0].Arr[1:arg]) |
| 238 |
{} |
| 239 |
#pragma omp target teams map(r.ArrS[0].Arr[arg:23]) |
| 240 |
{} |
| 241 |
#pragma omp target teams map(r.ArrS[0].Error) // expected-error {{no member named 'Error' in 'SB'}} |
| 242 |
{} |
| 243 |
#pragma omp target teams map(r.ArrS[0].A, r.ArrS[1].A) // lt50-error {{multiple array elements associated with the same variable are not allowed in map clauses of the same construct}} lt50-note {{used here}} |
| 244 |
{} |
| 245 |
#pragma omp target teams map(r.ArrS[0].A, t.ArrS[1].A) |
| 246 |
{} |
| 247 |
#pragma omp target teams map(r.PtrS[0], r.PtrS->B) // lt50-error {{same pointer dereferenced in multiple different ways in map clause expressions}} lt50-note {{used here}} |
| 248 |
{} |
| 249 |
#pragma omp target teams map(r.PtrS, r.PtrS->B) // lt50-error {{pointer cannot be mapped along with a section derived from itself}} lt50-note {{used here}} |
| 250 |
{} |
| 251 |
#pragma omp target teams map(r.PtrS->A, r.PtrS->B) |
| 252 |
{} |
| 253 |
#pragma omp target teams map(r.RPtrS[0], r.RPtrS->B) // lt50-error {{same pointer dereferenced in multiple different ways in map clause expressions}} lt50-note {{used here}} |
| 254 |
{} |
| 255 |
#pragma omp target teams map(r.RPtrS, r.RPtrS->B) // lt50-error {{pointer cannot be mapped along with a section derived from itself}} lt50-note {{used here}} |
| 256 |
{} |
| 257 |
#pragma omp target teams map(r.RPtrS->A, r.RPtrS->B) |
| 258 |
{} |
| 259 |
#pragma omp target teams map(r.S.Arr[:12]) |
| 260 |
{} |
| 261 |
// ge50-error@+2 {{expected addressable lvalue in 'map' clause}} |
| 262 |
// lt50-error@+1 {{expected expression containing only member accesses and/or array sections based on named variables}} |
| 263 |
#pragma omp target teams map(r.S.foo()[:12]) |
| 264 |
{} |
| 265 |
#pragma omp target teams map(r.C, r.D) |
| 266 |
{} |
| 267 |
#pragma omp target teams map(r.C, r.C) // lt50-error {{variable already marked as mapped in current construct}} lt50-note {{used here}} |
| 268 |
{} |
| 269 |
#pragma omp target teams map(r.C) map(r.C) // lt50-error {{variable already marked as mapped in current construct}} lt50-note {{used here}} |
| 270 |
{} |
| 271 |
#pragma omp target teams map(r.C, r.S) // this would be an error only caught at runtime - Sema would have to make sure there is not way for the missing data between fields to be mapped somewhere else. |
| 272 |
{} |
| 273 |
#pragma omp target teams map(r, r.S) // lt50-error {{variable already marked as mapped in current construct}} lt50-note {{used here}} |
| 274 |
{} |
| 275 |
#pragma omp target teams map(r.C, t.C) |
| 276 |
{} |
| 277 |
#pragma omp target teams map(r.A) // expected-error {{bit fields cannot be used to specify storage in a 'map' clause}} |
| 278 |
{} |
| 279 |
#pragma omp target teams map(r.Arr) |
| 280 |
{} |
| 281 |
#pragma omp target teams map(r.Arr[3:5]) |
| 282 |
{} |
| 283 |
#pragma omp target teams map(r.Ptr[3:5]) |
| 284 |
{} |
| 285 |
#pragma omp target teams map(r.ArrS[3:5].A) // expected-error {{OpenMP array section is not allowed here}} |
| 286 |
{} |
| 287 |
#pragma omp target teams map(r.ArrS[3:5].Arr[6:7]) // expected-error {{OpenMP array section is not allowed here}} |
| 288 |
{} |
| 289 |
#pragma omp target teams map(r.ArrS[3].Arr[6:7]) |
| 290 |
{} |
| 291 |
#pragma omp target teams map(r.S.Arr[4:5]) |
| 292 |
{} |
| 293 |
#pragma omp target teams map(r.S.Ptr[4:5]) |
| 294 |
{} |
| 295 |
#pragma omp target teams map(r.S.Ptr[:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}} |
| 296 |
{} |
| 297 |
// lt50-error@+1 {{expected expression containing only member accesses and/or array sections based on named variables}} |
| 298 |
#pragma omp target teams map((p+1)->A) |
| 299 |
{} |
| 300 |
#pragma omp target teams map(u.B) // expected-error {{mapping of union members is not allowed}} |
| 301 |
{} |
| 302 |
|
| 303 |
#pragma omp target data map(to: r.C) // lt50-note {{used here}} |
| 304 |
{ |
| 305 |
#pragma omp target teams map(r.D) // lt50-error {{original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage}} |
| 306 |
{} |
| 307 |
} |
| 308 |
|
| 309 |
#pragma omp target data map(to: t.Ptr) // lt50-note {{used here}} |
| 310 |
{ |
| 311 |
#pragma omp target teams map(t.Ptr[:23]) // lt50-error {{pointer cannot be mapped along with a section derived from itself}} |
| 312 |
{} |
| 313 |
} |
| 314 |
|
| 315 |
#pragma omp target data map(to: t.C, t.D) |
| 316 |
{ |
| 317 |
#pragma omp target data map(to: t.C) |
| 318 |
{ |
| 319 |
#pragma omp target teams map(t.D) |
| 320 |
{} |
| 321 |
} |
| 322 |
} |
| 323 |
|
| 324 |
#pragma omp target data map(to: t) |
| 325 |
{ |
| 326 |
#pragma omp target data map(to: t.C) |
| 327 |
{ |
| 328 |
#pragma omp target teams map(t.D) |
| 329 |
{} |
| 330 |
} |
| 331 |
} |
| 332 |
} |
| 333 |
void foo() { |
| 334 |
} |
| 335 |
|
| 336 |
bool foobool(int argc) { |
| 337 |
return argc; |
| 338 |
} |
| 339 |
|
| 340 |
struct S1; // expected-note 2 {{declared here}} // expected-note 3 {{forward declaration of 'S1'}} |
| 341 |
extern S1 a; |
| 342 |
class S2 { |
| 343 |
mutable int a; |
| 344 |
public: |
| 345 |
S2():a(0) { } |
| 346 |
S2(S2 &s2):a(s2.a) { } |
| 347 |
static float S2s; |
| 348 |
static const float S2sc; |
| 349 |
}; |
| 350 |
const float S2::S2sc = 0; |
| 351 |
const S2 b; |
| 352 |
const S2 ba[5]; |
| 353 |
class S3 { |
| 354 |
int a; |
| 355 |
public: |
| 356 |
S3():a(0) { } |
| 357 |
S3(S3 &s3):a(s3.a) { } |
| 358 |
}; |
| 359 |
const S3 c; |
| 360 |
const S3 ca[5]; |
| 361 |
extern const int f; |
| 362 |
class S4 { |
| 363 |
int a; |
| 364 |
S4(); |
| 365 |
S4(const S4 &s4); |
| 366 |
public: |
| 367 |
S4(int v):a(v) { } |
| 368 |
}; |
| 369 |
class S5 { |
| 370 |
int a; |
| 371 |
S5():a(0) {} |
| 372 |
S5(const S5 &s5):a(s5.a) { } |
| 373 |
public: |
| 374 |
S5(int v):a(v) { } |
| 375 |
}; |
| 376 |
|
| 377 |
template <class T> |
| 378 |
struct S6; |
| 379 |
|
| 380 |
template<> |
| 381 |
struct S6<int> |
| 382 |
{ |
| 383 |
virtual void foo(); |
| 384 |
}; |
| 385 |
|
| 386 |
S3 h; |
| 387 |
#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}} |
| 388 |
|
| 389 |
typedef int from; |
| 390 |
|
| 391 |
template <typename T, int I> // expected-note {{declared here}} |
| 392 |
T tmain(T argc) { |
| 393 |
const T d = 5; |
| 394 |
const T da[5] = { 0 }; |
| 395 |
S4 e(4); |
| 396 |
S5 g(5); |
| 397 |
T i, t[20]; |
| 398 |
T &j = i; |
| 399 |
T *k = &j; |
| 400 |
T x; |
| 401 |
T y; |
| 402 |
T to, tofrom, always; |
| 403 |
const T (&l)[5] = da; |
| 404 |
#pragma omp target teams map // expected-error {{expected '(' after 'map'}} |
| 405 |
{} |
| 406 |
#pragma omp target teams map( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} |
| 407 |
{} |
| 408 |
#pragma omp target teams map() // expected-error {{expected expression}} |
| 409 |
{} |
| 410 |
#pragma omp target teams map(alloc) // expected-error {{use of undeclared identifier 'alloc'}} |
| 411 |
{} |
| 412 |
#pragma omp target teams map(to argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 'map' clause}} |
| 413 |
{} |
| 414 |
#pragma omp target teams map(to:) // expected-error {{expected expression}} |
| 415 |
{} |
| 416 |
#pragma omp target teams map(from: argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 417 |
{} |
| 418 |
#pragma omp target teams map(x: y) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}} |
| 419 |
{} |
| 420 |
#pragma omp target teams map(x) |
| 421 |
foo(); |
| 422 |
#pragma omp target teams map(tofrom: t[:I]) |
| 423 |
foo(); |
| 424 |
#pragma omp target teams map(T: a) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}} expected-error {{incomplete type 'S1' where a complete type is required}} |
| 425 |
foo(); |
| 426 |
#pragma omp target teams map(T) // expected-error {{'T' does not refer to a value}} |
| 427 |
foo(); |
| 428 |
// ge50-error@+2 2 {{expected addressable lvalue in 'map' clause}} |
| 429 |
// lt50-error@+1 2 {{expected expression containing only member accesses and/or array sections based on named variables}} |
| 430 |
#pragma omp target teams map(I) |
| 431 |
foo(); |
| 432 |
#pragma omp target teams map(S2::S2s) |
| 433 |
foo(); |
| 434 |
#pragma omp target teams map(S2::S2sc) |
| 435 |
foo(); |
| 436 |
#pragma omp target teams map(x) |
| 437 |
foo(); |
| 438 |
#pragma omp target teams map(to: x) |
| 439 |
foo(); |
| 440 |
#pragma omp target teams map(to: to) |
| 441 |
foo(); |
| 442 |
#pragma omp target teams map(to) |
| 443 |
foo(); |
| 444 |
#pragma omp target teams map(to, x) |
| 445 |
foo(); |
| 446 |
|
| 447 |
#pragma omp target data map(to x) // expected-error {{expected ',' or ')' in 'map' clause}} |
| 448 |
// ge50-error@+2 2 {{expected addressable lvalue in 'map' clause}} |
| 449 |
// lt50-error@+1 2 {{expected expression containing only member accesses and/or array sections based on named variables}} |
| 450 |
#pragma omp target data map(tofrom: argc > 0 ? x : y) |
| 451 |
|
| 452 |
#pragma omp target data map(argc) |
| 453 |
#pragma omp target data map(S1) // expected-error {{'S1' does not refer to a value}} |
| 454 |
#pragma omp target data map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} |
| 455 |
#pragma omp target data map(ba) |
| 456 |
#pragma omp target data map(ca) |
| 457 |
#pragma omp target data map(da) |
| 458 |
#pragma omp target data map(S2::S2s) |
| 459 |
#pragma omp target data map(S2::S2sc) |
| 460 |
#pragma omp target data map(e, g) |
| 461 |
#pragma omp target data map(h) // expected-error {{threadprivate variables are not allowed in 'map' clause}} |
| 462 |
#pragma omp target data map(k) map(k) // lt50-error 2 {{variable already marked as mapped in current construct}} lt50-note 2 {{used here}} |
| 463 |
#pragma omp target teams map(k), map(k[:5]) // lt50-error 2 {{pointer cannot be mapped along with a section derived from itself}} lt50-note 2 {{used here}} |
| 464 |
foo(); |
| 465 |
|
| 466 |
#pragma omp target data map(da) |
| 467 |
#pragma omp target teams map(da[:4]) |
| 468 |
foo(); |
| 469 |
|
| 470 |
#pragma omp target data map(k, j, l) // lt50-note 2 {{used here}} |
| 471 |
#pragma omp target data map(k[:4]) // lt50-error 2 {{pointer cannot be mapped along with a section derived from itself}} |
| 472 |
#pragma omp target data map(j) |
| 473 |
#pragma omp target teams map(l) map(l[:5]) // lt50-error 2 {{variable already marked as mapped in current construct}} lt50-note 2 {{used here}} |
| 474 |
foo(); |
| 475 |
|
| 476 |
#pragma omp target data map(k[:4], j, l[:5]) // lt50-note 2 {{used here}} |
| 477 |
#pragma omp target data map(k) // lt50-error 2 {{pointer cannot be mapped along with a section derived from itself}} |
| 478 |
#pragma omp target data map(j) |
| 479 |
#pragma omp target teams map(l) |
| 480 |
foo(); |
| 481 |
|
| 482 |
#pragma omp target data map(always, tofrom: x) |
| 483 |
#pragma omp target data map(always: x) // expected-error {{missing map type}} |
| 484 |
// ge51-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}} |
| 485 |
// lt51-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}} |
| 486 |
// expected-error@+1 {{missing map type}} |
| 487 |
#pragma omp target data map(tofrom, always: x) |
| 488 |
#pragma omp target data map(always, tofrom: always, tofrom, x) |
| 489 |
#pragma omp target teams map(tofrom j) // expected-error {{expected ',' or ')' in 'map' clause}} |
| 490 |
foo(); |
| 491 |
return 0; |
| 492 |
} |
| 493 |
|
| 494 |
int main(int argc, char **argv) { |
| 495 |
const int d = 5; |
| 496 |
const int da[5] = { 0 }; |
| 497 |
S4 e(4); |
| 498 |
S5 g(5); |
| 499 |
int i; |
| 500 |
int &j = i; |
| 501 |
int *k = &j; |
| 502 |
S6<int> m; |
| 503 |
int x; |
| 504 |
int y; |
| 505 |
int to, tofrom, always; |
| 506 |
const int (&l)[5] = da; |
| 507 |
// expected-error@+3 {{expected '(' after 'map'}} |
| 508 |
// ge50-error@+2 {{expected at least one 'map', 'use_device_ptr', or 'use_device_addr' clause for '#pragma omp target data'}} |
| 509 |
// lt50-error@+1 {{expected at least one 'map' or 'use_device_ptr' clause for '#pragma omp target data'}} |
| 510 |
#pragma omp target data map |
| 511 |
#pragma omp target data map( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} |
| 512 |
#pragma omp target data map() // expected-error {{expected expression}} |
| 513 |
#pragma omp target data map(alloc) // expected-error {{use of undeclared identifier 'alloc'}} |
| 514 |
#pragma omp target data map(to argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 'map' clause}} |
| 515 |
#pragma omp target data map(to:) // expected-error {{expected expression}} |
| 516 |
#pragma omp target data map(from: argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 517 |
#pragma omp target data map(x: y) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}} |
| 518 |
#pragma omp target teams map(x) |
| 519 |
foo(); |
| 520 |
|
| 521 |
#pragma omp target teams map(to: x) |
| 522 |
foo(); |
| 523 |
#pragma omp target teams map(to: to) |
| 524 |
foo(); |
| 525 |
#pragma omp target teams map(to) |
| 526 |
foo(); |
| 527 |
#pragma omp target teams map(to, x) |
| 528 |
foo(); |
| 529 |
|
| 530 |
#pragma omp target data map(to x) // expected-error {{expected ',' or ')' in 'map' clause}} |
| 531 |
// ge50-error@+2 {{expected addressable lvalue in 'map' clause}} |
| 532 |
// lt50-error@+1 {{expected expression containing only member accesses and/or array sections based on named variables}} |
| 533 |
#pragma omp target data map(tofrom: argc > 0 ? argv[1] : argv[2]) |
| 534 |
#pragma omp target data map(argc) |
| 535 |
#pragma omp target data map(S1) // expected-error {{'S1' does not refer to a value}} |
| 536 |
#pragma omp target data map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} |
| 537 |
#pragma omp target data map(argv[1]) |
| 538 |
#pragma omp target data map(ba) |
| 539 |
#pragma omp target data map(ca) |
| 540 |
#pragma omp target data map(da) |
| 541 |
#pragma omp target data map(S2::S2s) |
| 542 |
#pragma omp target data map(S2::S2sc) |
| 543 |
#pragma omp target data map(e, g) |
| 544 |
#pragma omp target data map(h) // expected-error {{threadprivate variables are not allowed in 'map' clause}} |
| 545 |
#pragma omp target data map(k), map(k) // lt50-error {{variable already marked as mapped in current construct}} lt50-note {{used here}} |
| 546 |
#pragma omp target teams map(k), map(k[:5]) // lt50-error {{pointer cannot be mapped along with a section derived from itself}} lt50-note {{used here}} |
| 547 |
foo(); |
| 548 |
|
| 549 |
#pragma omp target data map(da) |
| 550 |
#pragma omp target teams map(da[:4]) |
| 551 |
foo(); |
| 552 |
|
| 553 |
#pragma omp target data map(k, j, l) // lt50-note {{used here}} |
| 554 |
#pragma omp target data map(k[:4]) // lt50-error {{pointer cannot be mapped along with a section derived from itself}} |
| 555 |
#pragma omp target data map(j) |
| 556 |
#pragma omp target teams map(l) map(l[:5]) // lt50-error {{variable already marked as mapped in current construct}} lt50-note {{used here}} |
| 557 |
foo(); |
| 558 |
|
| 559 |
#pragma omp target data map(k[:4], j, l[:5]) // lt50-note {{used here}} |
| 560 |
#pragma omp target data map(k) // lt50-error {{pointer cannot be mapped along with a section derived from itself}} |
| 561 |
#pragma omp target data map(j) |
| 562 |
#pragma omp target teams map(l) |
| 563 |
foo(); |
| 564 |
|
| 565 |
#pragma omp target data map(always, tofrom: x) |
| 566 |
#pragma omp target data map(always: x) // expected-error {{missing map type}} |
| 567 |
// ge51-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}} |
| 568 |
// lt51-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}} |
| 569 |
// expected-error@+1 {{missing map type}} |
| 570 |
#pragma omp target data map(tofrom, always: x) |
| 571 |
#pragma omp target data map(always, tofrom: always, tofrom, x) |
| 572 |
#pragma omp target teams map(tofrom j) // expected-error {{expected ',' or ')' in 'map' clause}} |
| 573 |
foo(); |
| 574 |
|
| 575 |
// lt50-error@+2 {{private variable cannot be in a map clause in '#pragma omp target teams' directive}} |
| 576 |
// lt50-note@+1 {{defined as private}} |
| 577 |
#pragma omp target teams private(j) map(j) |
| 578 |
{} |
| 579 |
|
| 580 |
// lt50-error@+2 {{firstprivate variable cannot be in a map clause in '#pragma omp target teams' directive}} |
| 581 |
// lt50-note@+1 {{defined as firstprivate}} |
| 582 |
#pragma omp target teams firstprivate(j) map(j) |
| 583 |
{} |
| 584 |
|
| 585 |
#pragma omp target teams map(m) |
| 586 |
{} |
| 587 |
|
| 588 |
int **BB, *offset, *a; |
| 589 |
|
| 590 |
// lt50-error@+1 {{expected expression containing only member accesses and/or array sections based on named variables}} |
| 591 |
#pragma omp target teams map(**(BB+*offset)) |
| 592 |
{} |
| 593 |
// lt50-error@+1 {{expected expression containing only member accesses and/or array sections based on named variables}} |
| 594 |
#pragma omp target teams map(**(BB+y)) |
| 595 |
{} |
| 596 |
// lt50-error@+1 {{expected expression containing only member accesses and/or array sections based on named variables}} |
| 597 |
#pragma omp target teams map(*(a+*offset)) |
| 598 |
{} |
| 599 |
// lt50-error@+1 {{expected expression containing only member accesses and/or array sections based on named variables}} |
| 600 |
#pragma omp target teams map(**(*offset+BB)) |
| 601 |
{} |
| 602 |
// lt50-error@+1 {{expected expression containing only member accesses and/or array sections based on named variables}} |
| 603 |
#pragma omp target teams map(**(y+BB)) |
| 604 |
{} |
| 605 |
// lt50-error@+1 {{expected expression containing only member accesses and/or array sections based on named variables}} |
| 606 |
#pragma omp target teams map(*(*offset+a)) |
| 607 |
{} |
| 608 |
// lt50-error@+1 {{expected expression containing only member accesses and/or array sections based on named variables}} |
| 609 |
#pragma omp target teams map(**(*offset+BB+*a)) |
| 610 |
{} |
| 611 |
// lt50-error@+1 {{expected expression containing only member accesses and/or array sections based on named variables}} |
| 612 |
#pragma omp target teams map(**(*(*(&offset))+BB+*a)) |
| 613 |
{} |
| 614 |
#pragma omp target teams map(*(a+(a))) // expected-error {{invalid operands to binary expression ('int *' and 'int *')}} |
| 615 |
{} |
| 616 |
#pragma omp target teams map(*(1+*a+*a)) // expected-error {{indirection requires pointer operand ('int' invalid)}} |
| 617 |
{} |
| 618 |
|
| 619 |
#pragma omp target teams map(delete: j) // expected-error {{map type 'delete' is not allowed for '#pragma omp target teams'}} |
| 620 |
{} |
| 621 |
#pragma omp target teams map(release: j) // expected-error {{map type 'release' is not allowed for '#pragma omp target teams'}} |
| 622 |
{} |
| 623 |
|
| 624 |
return tmain<int, 3>(argc)+tmain<from, 4>(argc); // expected-note {{in instantiation of function template specialization 'tmain<int, 3>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<int, 4>' requested here}} |
| 625 |
} |
| 626 |
#endif |