Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / target_teams_map_messages.cpp
blob9da3e752f635ba50727d0a9ae3199747016560b5
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;
13 double marr[10][10][10];
15 #pragma omp target teams map(marr[2][0:2][0:2]) // expected-error {{array section does not specify contiguous storage}}
17 #pragma omp target teams map(marr[:][0:][:])
19 #pragma omp target teams map(marr[:][1:][:]) // expected-error {{array section does not specify contiguous storage}}
21 #pragma omp target teams map(marr[:][n:][:])
24 #else
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)
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)
46 #pragma omp target teams map(arg[2:2],a,d) // expected-error {{subscripted value is not an array or pointer}}
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)
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])
55 #pragma omp target teams map(arg,a[:2],d) // expected-error {{subscripted value is not an array or pointer}}
57 #pragma omp target teams map(arg,a,d[:2]) // expected-error {{subscripted value is not an array or pointer}}
60 #pragma omp target teams map(to:ss) // expected-error {{threadprivate variables are not allowed in 'map' clause}}
63 #pragma omp target teams map(to:b,e)
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}}
67 #pragma omp target teams map(to:b[:2],e)
69 #pragma omp target teams map(to:b,e[:])
71 #pragma omp target teams map(b[-1:]) // expected-error {{array section must be a subset of the original array}}
73 #pragma omp target teams map(b[:-1]) // expected-error {{section length is evaluated to a negative value -1}}
75 #pragma omp target teams map(b[true:true])
78 #pragma omp target teams map(always, tofrom: c,f)
80 #pragma omp target teams map(always, tofrom: c[1:2],f)
82 #pragma omp target teams map(always, tofrom: c,f[1:2])
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}}
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}}
88 #pragma omp target teams map(always tofrom: c) // omp52-error {{missing ',' after map type modifier}}
90 return;
94 struct SB {
95 unsigned A;
96 unsigned B;
97 float Arr[100];
98 float *Ptr;
99 float *foo() {
100 return &Arr[0];
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;
116 SC(SB *&_RPtrS) : RPtrS(_RPtrS) {}
119 union SD {
120 unsigned A;
121 float B;
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];
135 SB *p;
137 SD u;
138 SC r(p),t(p);
139 #pragma omp target teams map(r)
141 #pragma omp target teams map(marr[2][0:2][0:2]) // expected-error {{array section does not specify contiguous storage}}
143 #pragma omp target teams map(marr[:][0:2][0:2]) // expected-error {{array section does not specify contiguous storage}}
145 #pragma omp target teams map(marr[2][3][0:2])
147 #pragma omp target teams map(marr[:][:][:])
149 #pragma omp target teams map(marr[:2][:][:])
151 #pragma omp target teams map(marr[arg:][:][:])
153 #pragma omp target teams map(marr[arg:])
155 #pragma omp target teams map(marr[arg:][:arg][:]) // correct if arg is the size of dimension 2
157 #pragma omp target teams map(marr[:arg][:])
159 #pragma omp target teams map(marr[:arg][n:])
161 #pragma omp target teams map(marr[:][:arg][n:]) // correct if arg is the size of dimension 2
163 #pragma omp target teams map(marr[:][:m][n:]) // expected-error {{array section does not specify contiguous storage}}
165 #pragma omp target teams map(marr[n:m][:arg][n:])
167 #pragma omp target teams map(marr[:2][:1][:]) // expected-error {{array section does not specify contiguous storage}}
169 #pragma omp target teams map(marr[:2][1:][:]) // expected-error {{array section does not specify contiguous storage}}
171 #pragma omp target teams map(marr[:2][:][:1]) // expected-error {{array section does not specify contiguous storage}}
173 #pragma omp target teams map(marr[:2][:][1:]) // expected-error {{array section does not specify contiguous storage}}
175 #pragma omp target teams map(marr[:1][:2][:])
177 #pragma omp target teams map(marr[:1][0][:])
179 #pragma omp target teams map(marr[:arg][:2][:]) // correct if arg is 1
181 #pragma omp target teams map(marr[:1][3:1][:2])
183 #pragma omp target teams map(marr[:1][3:arg][:2]) // correct if arg is 1
185 #pragma omp target teams map(marr[:1][3:2][:2]) // expected-error {{array section does not specify contiguous storage}}
187 #pragma omp target teams map(marr[:2][:10][:])
189 #pragma omp target teams map(marr[:2][:][:5+5])
191 #pragma omp target teams map(marr[:2][2+2-4:][0:5+5])
194 #pragma omp target teams map(marr[:1][:2][0]) // expected-error {{array section does not specify contiguous storage}}
196 #pragma omp target teams map(marr2[:1][:2][0])
199 #pragma omp target teams map(mvla[:1][:][0]) // correct if the size of dimension 2 is 1.
201 #pragma omp target teams map(mvla[:2][:arg][:]) // correct if arg is the size of dimension 2.
203 #pragma omp target teams map(mvla[:1][:2][0]) // expected-error {{array section does not specify contiguous storage}}
205 #pragma omp target teams map(mvla[1][2:arg][:])
207 #pragma omp target teams map(mvla[:1][:][:])
209 #pragma omp target teams map(mvla2[:1][:2][:11])
211 #pragma omp target teams map(mvla2[:1][:2][:10]) // expected-error {{array section does not specify contiguous storage}}
214 #pragma omp target teams map(mptr[:2][2+2-4:1][0:5+5]) // expected-error {{array section does not specify contiguous storage}}
216 #pragma omp target teams map(mptr[:1][:2-1][2:4-3])
218 #pragma omp target teams map(mptr[:1][:arg][2:4-3]) // correct if arg is 1.
220 #pragma omp target teams map(mptr[:1][:2-1][0:2])
222 #pragma omp target teams map(mptr[:1][:2][0:2]) // expected-error {{array section does not specify contiguous storage}}
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}}
226 #pragma omp target teams map(mptr[:2][:1][0:2]) // expected-error {{array section does not specify contiguous storage}}
229 #pragma omp target teams map(r.ArrS[0].B)
231 #pragma omp target teams map(r.ArrS[:1].B) // expected-error {{OpenMP array section is not allowed here}}
233 #pragma omp target teams map(r.ArrS[:arg].B) // expected-error {{OpenMP array section is not allowed here}}
235 #pragma omp target teams map(r.ArrS[0].Arr[1:23])
237 #pragma omp target teams map(r.ArrS[0].Arr[1:arg])
239 #pragma omp target teams map(r.ArrS[0].Arr[arg:23])
241 #pragma omp target teams map(r.ArrS[0].Error) // expected-error {{no member named 'Error' in 'SB'}}
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}}
245 #pragma omp target teams map(r.ArrS[0].A, t.ArrS[1].A)
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}}
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}}
251 #pragma omp target teams map(r.PtrS->A, r.PtrS->B)
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}}
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}}
257 #pragma omp target teams map(r.RPtrS->A, r.RPtrS->B)
259 #pragma omp target teams map(r.S.Arr[:12])
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])
265 #pragma omp target teams map(r.C, r.D)
267 #pragma omp target teams map(r.C, r.C) // lt50-error {{variable already marked as mapped in current construct}} lt50-note {{used here}}
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}}
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.
273 #pragma omp target teams map(r, r.S) // lt50-error {{variable already marked as mapped in current construct}} lt50-note {{used here}}
275 #pragma omp target teams map(r.C, t.C)
277 #pragma omp target teams map(r.A) // expected-error {{bit fields cannot be used to specify storage in a 'map' clause}}
279 #pragma omp target teams map(r.Arr)
281 #pragma omp target teams map(r.Arr[3:5])
283 #pragma omp target teams map(r.Ptr[3:5])
285 #pragma omp target teams map(r.ArrS[3:5].A) // expected-error {{OpenMP array section is not allowed here}}
287 #pragma omp target teams map(r.ArrS[3:5].Arr[6:7]) // expected-error {{OpenMP array section is not allowed here}}
289 #pragma omp target teams map(r.ArrS[3].Arr[6:7])
291 #pragma omp target teams map(r.S.Arr[4:5])
293 #pragma omp target teams map(r.S.Ptr[4:5])
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}}
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)
300 #pragma omp target teams map(u.B) // expected-error {{mapping of union members is not allowed}}
303 #pragma omp target data map(to: r.C) // lt50-note {{used here}}
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}}
309 #pragma omp target data map(to: t.Ptr) // lt50-note {{used here}}
311 #pragma omp target teams map(t.Ptr[:23]) // lt50-error {{pointer cannot be mapped along with a section derived from itself}}
315 #pragma omp target data map(to: t.C, t.D)
317 #pragma omp target data map(to: t.C)
319 #pragma omp target teams map(t.D)
324 #pragma omp target data map(to: t)
326 #pragma omp target data map(to: t.C)
328 #pragma omp target teams map(t.D)
333 void foo() {
336 bool foobool(int argc) {
337 return argc;
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;
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) { }
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) { }
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) { }
377 template <class T>
378 struct S6;
380 template<>
381 struct S6<int>
383 virtual void foo();
386 S3 h;
387 #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
389 typedef int from;
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'}}
406 #pragma omp target teams map( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
408 #pragma omp target teams map() // expected-error {{expected expression}}
410 #pragma omp target teams map(alloc) // expected-error {{use of undeclared identifier 'alloc'}}
412 #pragma omp target teams map(to argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 'map' clause}}
414 #pragma omp target teams map(to:) // expected-error {{expected expression}}
416 #pragma omp target teams map(from: argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
418 #pragma omp target teams map(x: y) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
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();
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)
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();
466 #pragma omp target data map(da)
467 #pragma omp target teams map(da[:4])
468 foo();
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();
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();
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;
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();
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();
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();
549 #pragma omp target data map(da)
550 #pragma omp target teams map(da[:4])
551 foo();
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();
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();
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();
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)
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)
585 #pragma omp target teams map(m)
588 int **BB, *offset, *a;
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))
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))
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))
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))
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))
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))
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))
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))
614 #pragma omp target teams map(*(a+(a))) // expected-error {{invalid operands to binary expression ('int *' and 'int *')}}
616 #pragma omp target teams map(*(1+*a+*a)) // expected-error {{indirection requires pointer operand ('int' invalid)}}
619 #pragma omp target teams map(delete: j) // expected-error {{map type 'delete' is not allowed for '#pragma omp target teams'}}
621 #pragma omp target teams map(release: j) // expected-error {{map type 'release' is not allowed for '#pragma omp target teams'}}
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}}
626 #endif