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