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