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