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