Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / target_map_messages.cpp
bloba6776ee12c0ee2f8e95cbef6c8ff1ad941f75455
1 // -fopenmp, -fno-openmp-extensions
2 // RUN: %clang_cc1 -verify=expected,ge50,lt51,omp,lt51-omp -fopenmp -fno-openmp-extensions -fopenmp-version=50 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
3 // RUN: %clang_cc1 -verify=expected,lt50,lt51,omp,lt51-omp -fopenmp -fno-openmp-extensions -fopenmp-version=40 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
4 // RUN: %clang_cc1 -verify=expected,lt50,lt51,omp,lt51-omp -fopenmp -fno-openmp-extensions -fopenmp-version=45 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
5 // RUN: %clang_cc1 -verify=expected,ge50,lt51,omp,lt51-omp -fopenmp -fno-openmp-extensions -fopenmp-version=50 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
6 // RUN: %clang_cc1 -verify=expected,ge50,ge51,omp,ge51-omp -fopenmp -fno-openmp-extensions -fopenmp-version=51 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
7 // RUN: %clang_cc1 -verify=expected,ge50,ge51,ge52,omp,ge52-omp,omp52 -fopenmp -fno-openmp-extensions -fopenmp-version=52 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
8 // RUN: %clang_cc1 -DCCODE -verify -fopenmp -fno-openmp-extensions -ferror-limit 300 -x c %s -Wno-openmp -Wuninitialized -Wno-vla
10 // -fopenmp-simd, -fno-openmp-extensions
11 // RUN: %clang_cc1 -verify=expected,ge50,lt51,omp,lt51-omp -fopenmp-simd -fno-openmp-extensions -fopenmp-version=50 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
12 // RUN: %clang_cc1 -verify=expected,lt50,lt51,omp,lt51-omp -fopenmp-simd -fno-openmp-extensions -fopenmp-version=40 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
13 // RUN: %clang_cc1 -verify=expected,lt50,lt51,omp,lt51-omp -fopenmp-simd -fno-openmp-extensions -fopenmp-version=45 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
14 // RUN: %clang_cc1 -verify=expected,ge50,lt51,omp,lt51-omp -fopenmp-simd -fno-openmp-extensions -fopenmp-version=50 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
15 // RUN: %clang_cc1 -verify=expected,ge50,ge51,omp,ge51-omp -fopenmp-simd -fno-openmp-extensions -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
16 // RUN: %clang_cc1 -DCCODE -verify -fopenmp-simd -fno-openmp-extensions -ferror-limit 300 -x c %s -Wno-openmp-mapping -Wuninitialized -Wno-vla
18 // -fopenmp -fopenmp-extensions
19 // RUN: %clang_cc1 -verify=expected,ge50,lt51,ompx,lt51-ompx -fopenmp -fopenmp-extensions -fopenmp-version=50 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
20 // RUN: %clang_cc1 -verify=expected,lt50,lt51,ompx,lt51-ompx -fopenmp -fopenmp-extensions -fopenmp-version=40 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
21 // RUN: %clang_cc1 -verify=expected,lt50,lt51,ompx,lt51-ompx -fopenmp -fopenmp-extensions -fopenmp-version=45 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
22 // RUN: %clang_cc1 -verify=expected,ge50,lt51,ompx,lt51-ompx -fopenmp -fopenmp-extensions -fopenmp-version=50 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
23 // RUN: %clang_cc1 -verify=expected,ge50,ge51,ompx,ge51-ompx -fopenmp -fopenmp-extensions -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
24 // RUN: %clang_cc1 -DCCODE -verify -fopenmp -fopenmp-extensions -ferror-limit 300 -x c %s -Wno-openmp -Wuninitialized -Wno-vla
26 // -fopenmp-simd -fopenmp-extensions
27 // RUN: %clang_cc1 -verify=expected,ge50,lt51,ompx,lt51-ompx -fopenmp-simd -fopenmp-extensions -fopenmp-version=50 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
28 // RUN: %clang_cc1 -verify=expected,lt50,lt51,ompx,lt51-ompx -fopenmp-simd -fopenmp-extensions -fopenmp-version=40 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
29 // RUN: %clang_cc1 -verify=expected,lt50,lt51,ompx,lt51-ompx -fopenmp-simd -fopenmp-extensions -fopenmp-version=45 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
30 // RUN: %clang_cc1 -verify=expected,ge50,lt51,ompx,lt51-ompx -fopenmp-simd -fopenmp-extensions -fopenmp-version=50 -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
31 // RUN: %clang_cc1 -verify=expected,ge50,ge51,ompx,ge51-ompx -fopenmp-simd -fopenmp-extensions -ferror-limit 300 %s -Wno-openmp-target -Wuninitialized -Wno-vla
32 // RUN: %clang_cc1 -DCCODE -verify -fopenmp-simd -fopenmp-extensions -ferror-limit 300 -x c %s -Wno-openmp-mapping -Wuninitialized -Wno-vla
34 // Check
35 #ifdef CCODE
36 void foo(int arg) {
37 const int n = 0;
39 double marr[10][10][10];
41 #pragma omp target map(marr[2][0:2][0:2]) // expected-error {{array section does not specify contiguous storage}}
43 #pragma omp target map(marr[:][0:][:])
45 #pragma omp target map(marr[:][1:][:]) // expected-error {{array section does not specify contiguous storage}}
47 #pragma omp target map(marr[:][n:][:])
50 #else
52 void xxx(int argc) {
53 int map; // expected-note {{initialize the variable 'map' to silence this warning}}
54 #pragma omp target map(tofrom: map) // expected-warning {{variable 'map' is uninitialized when used here}}
55 for (int i = 0; i < 10; ++i)
60 struct SREF {
61 int &a;
62 int b;
63 SREF(int &a) : a(a) {}
66 template <typename T, int I>
67 struct SA {
68 static int ss;
69 #pragma omp threadprivate(ss) // expected-note {{defined as threadprivate or thread local}}
70 float a;
71 int b[12];
72 float *c;
73 T d;
74 float e[I];
75 T *f;
76 int bf : 20;
77 void func(int arg) {
78 SREF sref(arg);
79 #pragma omp target
81 a = 0.0;
82 func(arg);
83 bf = 20;
85 #pragma omp target map(arg,a,d,sref.b)
87 #pragma omp target map(arg[2:2],a,d) // expected-error {{subscripted value is not an array or pointer}}
89 #pragma omp target map(arg,a*2) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}} ge50-error {{expected addressable lvalue in 'map' clause}}
91 #pragma omp target map(arg,(c+1)[2]) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}}
93 #pragma omp target map(arg,a[:2],d) // expected-error {{subscripted value is not an array or pointer}}
95 #pragma omp target map(arg,a,d[:2]) // expected-error {{subscripted value is not an array or pointer}}
98 #pragma omp target map(to:ss) // expected-error {{threadprivate variables are not allowed in 'map' clause}}
101 #pragma omp target map(to:b,e)
103 #pragma omp target map(to:b,e) map(to:b) // lt50-error {{variable already marked as mapped in current construct}} lt50-note {{used here}}
105 #pragma omp target map(to:b[:2],e)
107 #pragma omp target map(to:b,e[:])
109 #pragma omp target map(b[-1:]) // expected-error {{array section must be a subset of the original array}}
111 #pragma omp target map(b[:-1]) // expected-error {{section length is evaluated to a negative value -1}}
113 #pragma omp target map(b[true:true])
116 #pragma omp target map(: c,f) // expected-error {{missing map type}}
118 #pragma omp target map(always, tofrom: c,f)
120 #pragma omp target map(always, tofrom: c[1:2],f)
122 #pragma omp target map(always, tofrom: c,f[1:2])
124 #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}}
126 #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}}
128 #pragma omp target map(always) // expected-error {{use of undeclared identifier 'always'}}
130 #pragma omp target map(close, tofrom: c,f)
132 #pragma omp target map(close, tofrom: c[1:2],f)
134 #pragma omp target map(close, tofrom: c,f[1:2])
136 #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}}
138 #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}}
140 #pragma omp target map(close) // expected-error {{use of undeclared identifier 'close'}}
142 // lt51-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
143 #pragma omp target map(present, tofrom: c,f)
145 // lt51-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
146 #pragma omp target map(present, tofrom: c[1:2],f)
148 // lt51-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
149 #pragma omp target map(present, tofrom: c,f[1:2])
151 // expected-error@+2 {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
152 // lt51-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
153 #pragma omp target map(present, tofrom: c[:],f)
155 // expected-error@+2 {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
156 // lt51-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
157 #pragma omp target map(present, tofrom: c,f[:])
159 // expected-error@+1 {{use of undeclared identifier 'present'}}
160 #pragma omp target map(present)
162 // ge52-omp-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'iterator'}}
163 // ge51-omp-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
164 // lt51-omp-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
165 #pragma omp target map(ompx_hold, tofrom: c,f)
167 // ge52-omp-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'iterator'}}
168 // ge51-omp-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
169 // lt51-omp-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
170 #pragma omp target map(ompx_hold, tofrom: c[1:2],f)
172 // ge52-omp-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'iterator'}}
173 // ge51-omp-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
174 // lt51-omp-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
175 #pragma omp target map(ompx_hold, tofrom: c,f[1:2])
177 // ge52-omp-error@+4 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'iterator'}}
178 // expected-error@+3 {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
179 // ge51-omp-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
180 // lt51-omp-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
181 #pragma omp target map(ompx_hold, tofrom: c[:],f)
183 // ge52-omp-error@+4 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'iterator'}}
184 // expected-error@+3 {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
185 // ge51-omp-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
186 // lt51-omp-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
187 #pragma omp target map(ompx_hold, tofrom: c,f[:])
189 // expected-error@+1 {{use of undeclared identifier 'ompx_hold'}}
190 #pragma omp target map(ompx_hold)
192 #pragma omp target map(close, close, tofrom: a) // expected-error {{same map type modifier has been specified more than once}}
194 #pragma omp target map(always, close, always, close, tofrom: a) // expected-error 2 {{same map type modifier has been specified more than once}}
196 // ge51-error@+2 {{same map type modifier has been specified more than once}}
197 // lt51-error@+1 2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
198 #pragma omp target map(present, present, tofrom: a)
200 // ge52-omp-error@+5 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'iterator'}}
201 // ge52-omp-error@+4 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'iterator'}}
202 // ompx-error@+3 {{same map type modifier has been specified more than once}}
203 // ge51-omp-error@+2 2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
204 // lt51-omp-error@+1 2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
205 #pragma omp target map(ompx_hold, ompx_hold, tofrom: a)
207 // ge52-omp-error@+9 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'iterator'}}
208 // ge52-omp-error@+8 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'iterator'}}
209 // expected-error@+7 2 {{same map type modifier has been specified more than once}}
210 // ge51-error@+6 {{same map type modifier has been specified more than once}}
211 // lt51-ompx-error@+5 2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'ompx_hold'}}
212 // lt51-omp-error@+4 2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
213 // ompx-error@+3 {{same map type modifier has been specified more than once}}
214 // ge51-omp-error@+2 2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
215 // lt51-omp-error@+1 2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
216 #pragma omp target map(always, close, present, ompx_hold, always, close, present, ompx_hold, tofrom: a)
218 #pragma omp target map( , tofrom: a) // expected-error {{missing map type modifier}}
220 #pragma omp target map( , , tofrom: a) // expected-error {{missing map type modifier}} expected-error {{missing map type modifier}}
222 #pragma omp target map( , , : a) // expected-error {{missing map type modifier}} expected-error {{missing map type modifier}} expected-error {{missing map type}}
224 // ge51-error@+3 2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
225 // lt51-error@+2 2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
226 // expected-error@+1 {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
227 #pragma omp target map( d, f, bf: a)
229 // expected-error@+4 {{missing map type modifier}}
230 // ge51-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
231 // lt51-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
232 // expected-error@+1 {{missing map type}}
233 #pragma omp target map( , f, : a)
235 #pragma omp target map(always close: a) // expected-error {{missing map type}} omp52-error{{missing ',' after map type modifier}}
237 #pragma omp target map(always close bf: a) // omp52-error 2 {{missing ',' after map type modifier}} expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
239 // omp52-error@+4 {{missing ',' after map type modifier}}
240 // ge51-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
241 // lt51-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
242 // expected-error@+1 {{missing map type}}
243 #pragma omp target map(always tofrom close: a)
245 // ge51-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
246 // lt51-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
247 #pragma omp target map(tofrom from: a)
249 #pragma omp target map(close bf: a) // omp52-error {{missing ',' after map type modifier}} expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
251 #pragma omp target map(([b[I]][bf])f) // lt50-error {{expected ',' or ']' in lambda capture list}} lt50-error {{expected ')'}} lt50-note {{to match this '('}}
253 // ge51-ompx-error@+4 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'ompx_hold'}}
254 // lt51-ompx-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'ompx_hold'}}
255 // ge51-omp-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
256 // lt51-omp-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
257 #pragma omp target map(iterator(it=0:10), tofrom:a)
259 // ompx-error@+8 {{redefinition of 'it'}}
260 // ompx-note@+7 {{previous definition is here}}
261 // omp-error@+6 {{redefinition of 'it'}}
262 // omp-note@+5 {{previous definition is here}}
263 // ge51-ompx-error@+4 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'ompx_hold'}}
264 // lt51-ompx-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'ompx_hold'}}
265 // ge51-omp-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
266 // lt51-omp-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
267 #pragma omp target map(iterator(it=0:10, it=0:20), tofrom:a)
269 // ge51-ompx-error@+6 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'ompx_hold'}}
270 // lt51-ompx-error@+5 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'ompx_hold'}}
271 // lt51-error@+4 {{expected '(' after 'iterator'}}
272 // ge51-error@+3 {{expected '(' after 'iterator'}}
273 // ge51-omp-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
274 // lt51-omp-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
275 #pragma omp target map(iterator, tofrom:a)
277 // ge51-ompx-error@+4 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'ompx_hold'}}
278 // lt51-ompx-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'ompx_hold'}}
279 // ge51-omp-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
280 // lt51-omp-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
281 #pragma omp target map(iterator(), tofrom:a)
283 return;
287 struct SB {
288 unsigned A;
289 unsigned B;
290 float Arr[100];
291 float *Ptr;
292 float *foo() {
293 return &Arr[0];
297 struct SC {
298 unsigned A : 2;
299 unsigned B : 3;
300 unsigned C;
301 unsigned D;
302 float Arr[100];
303 SB S;
304 SB ArrS[100];
305 SB *PtrS;
306 SB *&RPtrS;
307 float *Ptr;
309 SC(SB *&_RPtrS) : RPtrS(_RPtrS) {}
312 union SD {
313 unsigned A;
314 float B;
317 void SAclient(int arg) {
318 SA<int,123> s;
319 s.func(arg); // expected-note {{in instantiation of member function}}
320 double marr[10][10][10];
321 double marr2[5][10][1];
322 double mvla[5][arg][10];
323 double ***mptr;
324 const int n = 0;
325 const int m = 1;
326 double mvla2[5][arg][m+n+10];
328 SB *p;
330 SD u;
331 SC r(p),t(p);
332 #pragma omp target map(r)
334 #pragma omp target map(marr[2] [0:2] [0:2]) // expected-error {{array section does not specify contiguous storage}}
336 #pragma omp target map(marr[:] [0:2] [0:2]) // expected-error {{array section does not specify contiguous storage}}
338 #pragma omp target map(marr[2][3] [0:2])
340 #pragma omp target map(marr[:][:][:])
342 #pragma omp target map(marr[:2][:][:])
344 #pragma omp target map(marr [arg:][:][:])
346 #pragma omp target map(marr [arg:])
348 #pragma omp target map(marr [arg:][:arg][:]) // correct if arg is the size of dimension 2
350 #pragma omp target map(marr[:arg][:])
352 #pragma omp target map(marr[:arg] [n:])
354 #pragma omp target map(marr[:][:arg] [n:]) // correct if arg is the size of dimension 2
356 #pragma omp target map(marr[:][:m] [n:]) // expected-error {{array section does not specify contiguous storage}}
358 #pragma omp target map(marr [n:m][:arg] [n:])
360 #pragma omp target map(marr[:2][:1][:]) // expected-error {{array section does not specify contiguous storage}}
362 #pragma omp target map(marr[:2] [1:][:]) // expected-error {{array section does not specify contiguous storage}}
364 #pragma omp target map(marr[:2][:][:1]) // expected-error {{array section does not specify contiguous storage}}
366 #pragma omp target map(marr[:2][:] [1:]) // expected-error {{array section does not specify contiguous storage}}
368 #pragma omp target map(marr[:1][:2][:])
370 #pragma omp target map(marr[:1][0][:])
372 #pragma omp target map(marr[:arg][:2][:]) // correct if arg is 1
374 #pragma omp target map(marr[:1] [3:1][:2])
376 #pragma omp target map(marr[:1] [3:arg][:2]) // correct if arg is 1
378 #pragma omp target map(marr[:1] [3:2][:2]) // expected-error {{array section does not specify contiguous storage}}
380 #pragma omp target map(marr[:2][:10][:])
382 #pragma omp target map(marr[:2][:][:5 + 5])
384 #pragma omp target map(marr[:2] [2 + 2 - 4:] [0:5 + 5])
387 #pragma omp target map(marr[:1][:2][0]) // expected-error {{array section does not specify contiguous storage}}
389 #pragma omp target map(marr2[:1][:2][0])
392 #pragma omp target map(mvla[:1][:][0]) // correct if the size of dimension 2 is 1.
394 #pragma omp target map(mvla[:2][:arg][:]) // correct if arg is the size of dimension 2.
396 #pragma omp target map(mvla[:1][:2][0]) // expected-error {{array section does not specify contiguous storage}}
398 #pragma omp target map(mvla[1] [2:arg][:])
400 #pragma omp target map(mvla[:1][:][:])
402 #pragma omp target map(mvla2[:1][:2][:11])
404 #pragma omp target map(mvla2[:1][:2][:10]) // expected-error {{array section does not specify contiguous storage}}
407 #pragma omp target map(mptr[:2] [2 + 2 - 4:1] [0:5 + 5]) // expected-error {{array section does not specify contiguous storage}}
409 #pragma omp target map(mptr[:1][:2 - 1] [2:4 - 3])
411 #pragma omp target map(mptr[:1][:arg] [2:4 - 3]) // correct if arg is 1.
413 #pragma omp target map(mptr[:1][:2 - 1] [0:2])
415 #pragma omp target map(mptr[:1][:2] [0:2]) // expected-error {{array section does not specify contiguous storage}}
417 #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}}
419 #pragma omp target map(mptr[:2][:1] [0:2]) // expected-error {{array section does not specify contiguous storage}}
422 #pragma omp target map(r.ArrS[0].B)
424 #pragma omp target map(r.ArrS[:1].B) // expected-error {{OpenMP array section is not allowed here}}
426 #pragma omp target map(r.ArrS[:arg].B) // expected-error {{OpenMP array section is not allowed here}}
428 #pragma omp target map(r.ArrS[0].Arr [1:23])
430 #pragma omp target map(r.ArrS[0].Arr [1:arg])
432 #pragma omp target map(r.ArrS[0].Arr [arg:23])
434 #pragma omp target map(r.ArrS[0].Error) // expected-error {{no member named 'Error' in 'SB'}}
436 #pragma omp target 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}}
438 #pragma omp target map(r.ArrS[0].A, t.ArrS[1].A)
440 #pragma omp target map(r.PtrS[0], r.PtrS->B) // lt50-error {{same pointer dereferenced in multiple different ways in map clause expressions}} lt50-note {{used here}}
442 #pragma omp target map(r.PtrS, r.PtrS->B) // lt50-error {{pointer cannot be mapped along with a section derived from itself}} lt50-note {{used here}}
444 #pragma omp target map(r.PtrS->A, r.PtrS->B)
446 #pragma omp target map(r.RPtrS[0], r.RPtrS->B) // lt50-error {{same pointer dereferenced in multiple different ways in map clause expressions}} lt50-note {{used here}}
448 #pragma omp target map(r.RPtrS, r.RPtrS->B) // lt50-error {{pointer cannot be mapped along with a section derived from itself}} lt50-note {{used here}}
450 #pragma omp target map(r.RPtrS->A, r.RPtrS->B)
452 #pragma omp target map(r.S.Arr[:12])
454 #pragma omp target map(r.S.foo() [:12]) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}} ge50-error {{expected addressable lvalue in 'map' clause}}
456 #pragma omp target map(r.C, r.D)
458 #pragma omp target map(r.C, r.C) // lt50-error {{variable already marked as mapped in current construct}} lt50-note {{used here}}
460 #pragma omp target map(r.C) map(r.C) // lt50-error {{variable already marked as mapped in current construct}} lt50-note {{used here}}
462 #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.
464 #pragma omp target map(r, r.S) // lt50-error {{variable already marked as mapped in current construct}} lt50-note {{used here}}
466 #pragma omp target map(r.C, t.C)
468 #pragma omp target map(r.A) // expected-error {{bit fields cannot be used to specify storage in a 'map' clause}}
470 #pragma omp target map(r.Arr)
472 #pragma omp target map(r.Arr [3:5])
474 #pragma omp target map(r.Ptr [3:5])
476 #pragma omp target map(r.ArrS [3:5].A) // expected-error {{OpenMP array section is not allowed here}}
478 #pragma omp target map(r.ArrS [3:5].Arr [6:7]) // expected-error {{OpenMP array section is not allowed here}}
480 #pragma omp target map(r.ArrS[3].Arr [6:7])
482 #pragma omp target map(r.S.Arr [4:5])
484 #pragma omp target map(r.S.Ptr [4:5])
486 #pragma omp target map(r.S.Ptr[:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
488 #pragma omp target map((p + 1)->A) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}}
490 #pragma omp target map(u.B) // expected-error {{mapping of union members is not allowed}}
492 #pragma omp target
494 u.B = 0;
495 r.S.foo();
498 #pragma omp target data map(to \
499 : r.C) // lt50-note {{used here}}
501 #pragma omp target map(r.D) // lt50-error {{original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage}}
505 #pragma omp target data map(to \
506 : t.Ptr) // lt50-note {{used here}}
508 #pragma omp target map(t.Ptr[:23]) // lt50-error {{pointer cannot be mapped along with a section derived from itself}}
512 #pragma omp target data map(to \
513 : t.C, t.D)
515 #pragma omp target data map(to \
516 : t.C)
518 #pragma omp target map(t.D)
522 #pragma omp target data map(marr[:][:][:])
524 #pragma omp target data map(marr)
528 #pragma omp target data map(to \
529 : t)
531 #pragma omp target data map(to \
532 : t.C)
534 #pragma omp target map(t.D)
539 void foo() {
542 bool foobool(int argc) {
543 return argc;
546 struct S1; // expected-note 2 {{declared here}} // expected-note 3 {{forward declaration of 'S1'}}
547 extern S1 a;
548 class S2 {
549 mutable int a;
550 public:
551 S2():a(0) { }
552 S2(S2 &s2):a(s2.a) { }
553 static float S2s;
554 static const float S2sc;
556 const float S2::S2sc = 0;
557 const S2 b;
558 const S2 ba[5];
559 class S3 {
560 int a;
561 public:
562 S3():a(0) { }
563 S3(S3 &s3):a(s3.a) { }
565 const S3 c;
566 const S3 ca[5];
567 extern const int f;
568 class S4 {
569 int a;
570 S4();
571 S4(const S4 &s4);
572 public:
573 S4(int v):a(v) { }
575 class S5 {
576 int a;
577 S5():a(0) {}
578 S5(const S5 &s5):a(s5.a) { }
579 public:
580 S5(int v):a(v) { }
583 template <class T>
584 struct S6;
586 template<>
587 struct S6<int>
589 virtual void foo();
592 S3 h;
593 #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
595 typedef int from;
597 struct dim {
598 double x, y;
601 template<typename T>
602 class Array1D
604 public:
605 unsigned n1;
606 unsigned size;
607 T * dptr;
609 inline T& operator() (unsigned i1) { return dptr[i1]; }
611 Array1D() {n1=0;size=0;dptr=nullptr;}
614 template <typename T, int I> // expected-note {{declared here}}
615 T tmain(T argc) {
616 const T d = 5;
617 const T da[5] = { 0 };
618 S4 e(4);
619 S5 g(5);
620 T i, t[20];
621 T &j = i;
622 T *k = &j;
623 T x;
624 T y;
625 T to, tofrom, always, close, present;
626 const T (&l)[5] = da;
627 #pragma omp target map // expected-error {{expected '(' after 'map'}}
629 #pragma omp target map( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
631 #pragma omp target map() // expected-error {{expected expression}}
633 #pragma omp target map(alloc) // expected-error {{use of undeclared identifier 'alloc'}}
635 #pragma omp target map(to argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 'map' clause}}
637 #pragma omp target map(to:) // expected-error {{expected expression}}
639 #pragma omp target map(from: argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
641 #pragma omp target map(x: y) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
643 #pragma omp target map(x)
644 foo();
645 #pragma omp target map(tofrom: t[:I])
646 foo();
647 #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}}
648 foo();
649 #pragma omp target map(T) // expected-error {{'T' does not refer to a value}}
650 foo();
651 #pragma omp target map(I) // lt50-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}} ge50-error 2 {{expected addressable lvalue in 'map' clause}}
652 foo();
653 #pragma omp target map(S2::S2s)
654 foo();
655 #pragma omp target map(S2::S2sc)
656 foo();
657 #pragma omp target map(x)
658 foo();
659 #pragma omp target map(to: x)
660 foo();
661 #pragma omp target map(to: to)
662 foo();
663 #pragma omp target map(to)
664 foo();
665 #pragma omp target map(to, x)
666 foo();
667 #pragma omp target data map(to x) // expected-error {{expected ',' or ')' in 'map' clause}}
668 #pragma omp target data map(tofrom: argc > 0 ? x : y) // lt50-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}} ge50-error 2 {{expected addressable lvalue in 'map' clause}}
669 #pragma omp target data map(argc)
670 #pragma omp target data map(S1) // expected-error {{'S1' does not refer to a value}}
671 #pragma omp target data map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} warn-warning 2 {{Type 'const S2' is not trivially copyable and not guaranteed to be mapped correctly}} warn-warning 2 {{Type 'const S3' is not trivially copyable and not guaranteed to be mapped correctly}}
672 #pragma omp target data map(ba) // warn-warning 2 {{Type 'const S2 [5]' is not trivially copyable and not guaranteed to be mapped correctly}}
673 #pragma omp target data map(ca) // warn-warning 2 {{Type 'const S3 [5]' is not trivially copyable and not guaranteed to be mapped correctly}}
674 #pragma omp target data map(da)
675 #pragma omp target data map(S2::S2s)
676 #pragma omp target data map(S2::S2sc)
677 #pragma omp target data map(e, g) // warn-warning 2 {{Type 'S4' is not trivially copyable and not guaranteed to be mapped correctly}} warn-warning 2 {{Type 'S5' is not trivially copyable and not guaranteed to be mapped correctly}}
678 #pragma omp target data map(h) // expected-error {{threadprivate variables are not allowed in 'map' clause}}
679 #pragma omp target data map(k) map(k) // lt50-error 2 {{variable already marked as mapped in current construct}} lt50-note 2 {{used here}}
680 #pragma omp target map(k), map(k[:5]) // lt50-error 2 {{pointer cannot be mapped along with a section derived from itself}} lt50-note 2 {{used here}}
681 foo();
682 #pragma omp target data map(da)
683 #pragma omp target map(da[:4])
684 foo();
685 #pragma omp target data map(k, j, l) // lt50-note 2 {{used here}}
686 #pragma omp target data map(k[:4]) // lt50-error 2 {{pointer cannot be mapped along with a section derived from itself}}
687 #pragma omp target data map(j)
688 #pragma omp target map(l) map(l[:5]) // lt50-error 2 {{variable already marked as mapped in current construct}} lt50-note 2 {{used here}}
689 foo();
690 #pragma omp target data map(k[:4], j, l[:5]) // lt50-note 2 {{used here}}
691 #pragma omp target data map(k) // lt50-error 2 {{pointer cannot be mapped along with a section derived from itself}}
692 #pragma omp target data map(j)
693 #pragma omp target map(l)
694 foo();
696 #pragma omp target data map(always, tofrom: x)
697 #pragma omp target data map(always: x) // expected-error {{missing map type}}
698 // ge51-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
699 // lt51-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
700 // expected-error@+1 {{missing map type}}
701 #pragma omp target data map(tofrom, always: x)
702 #pragma omp target data map(always, tofrom: always, tofrom, x)
703 #pragma omp target map(tofrom j) // expected-error {{expected ',' or ')' in 'map' clause}}
704 foo();
706 #pragma omp target data map(close, tofrom: x)
707 #pragma omp target data map(close: x) // expected-error {{missing map type}}
708 // ge51-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
709 // lt51-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
710 // expected-error@+1 {{missing map type}}
711 #pragma omp target data map(tofrom, close: x)
712 #pragma omp target data map(close, tofrom: close, tofrom, x)
713 foo();
715 // lt51-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
716 #pragma omp target data map(present, tofrom: x)
717 // ge51-error@+2 {{missing map type}}
718 // lt51-error@+1 {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
719 #pragma omp target data map(present: x)
720 // ge51-error@+4 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
721 // lt51-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
722 // ge51-error@+2 {{missing map type}}
723 // lt51-error@+1 {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
724 #pragma omp target data map(tofrom, present: x)
725 // lt51-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
726 #pragma omp target data map(present, tofrom: present, tofrom, x)
727 foo();
729 T marr[10][10], iarr[5];
730 #pragma omp target data map(marr[10][0:2:2]) // expected-error {{expected ']'}} expected-note {{to match this '['}}
732 #pragma omp target data map(iarr[:2:d]) // expected-error {{expected ']'}} expected-note {{to match this '['}}
734 return 0;
737 struct SA1{
738 int a;
739 struct SA1 *p;
740 int b[10];
742 struct SB1{
743 int a;
744 struct SA1 s;
745 struct SA1 sa[10];
746 struct SA1 *sp[10];
747 struct SA1 *p;
749 struct SC1{
750 int a;
751 struct SB1 s;
752 struct SB1 *p;
753 int b[10];
756 class S8 {
757 public:
758 virtual void foo() = 0;
759 } *s8;
761 class S9 {
762 public:
763 virtual void foo() {}
764 } s9;
767 int main(int argc, char **argv) {
768 const int d = 5;
769 const int da[5] = { 0 };
770 S4 e(4);
771 S5 g(5);
772 int i;
773 int &j = i;
774 int *k = &j;
775 S6<int> m;
776 int x;
777 int y;
778 int to, tofrom, always, close, present;
779 const int (&l)[5] = da;
780 SC1 s;
781 SC1 *p;
782 int Arr[10];
783 #pragma omp target data map // expected-error {{expected '(' after 'map'}} lt50-error {{expected at least one 'map' or 'use_device_ptr' clause for '#pragma omp target data'}} ge50-error {{expected at least one 'map', 'use_device_ptr', or 'use_device_addr' clause for '#pragma omp target data'}}
784 #pragma omp target data map( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
785 #pragma omp target data map() // expected-error {{expected expression}}
786 #pragma omp target data map(alloc) // expected-error {{use of undeclared identifier 'alloc'}}
787 #pragma omp target data map(to argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 'map' clause}}
788 #pragma omp target data map(to:) // expected-error {{expected expression}}
789 #pragma omp target data map(from: argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
790 #pragma omp target data map(x: y) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
791 #pragma omp target map(x)
792 foo();
793 #pragma omp target map(to: x)
794 foo();
795 #pragma omp target map(to: to)
796 foo();
797 #pragma omp target map(to)
798 foo();
799 #pragma omp target map(to, x)
800 foo();
801 #pragma omp target data map(to x) // expected-error {{expected ',' or ')' in 'map' clause}}
802 #pragma omp target data map(tofrom: argc > 0 ? argv[1] : argv[2]) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}} ge50-error {{expected addressable lvalue in 'map' clause}}
803 #pragma omp target data map(argc)
804 #pragma omp target data map(S1) // expected-error {{'S1' does not refer to a value}}
805 #pragma omp target data map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} warn-warning {{Type 'const S2' is not trivially copyable and not guaranteed to be mapped correctly}} warn-warning {{Type 'const S3' is not trivially copyable and not guaranteed to be mapped correctly}}
806 #pragma omp target data map(argv[1])
807 #pragma omp target data map(ba) // warn-warning {{Type 'const S2 [5]' is not trivially copyable and not guaranteed to be mapped correctly}}
808 #pragma omp target data map(ca) // warn-warning {{Type 'const S3 [5]' is not trivially copyable and not guaranteed to be mapped correctly}}
809 #pragma omp target data map(da)
810 #pragma omp target data map(S2::S2s)
811 #pragma omp target data map(S2::S2sc)
812 #pragma omp target data map(e, g) // warn-warning {{Type 'S4' is not trivially copyable and not guaranteed to be mapped correctly}} warn-warning {{Type 'S5' is not trivially copyable and not guaranteed to be mapped correctly}}
813 #pragma omp target data map(h) // expected-error {{threadprivate variables are not allowed in 'map' clause}}
814 #pragma omp target data map(k), map(k) // lt50-error {{variable already marked as mapped in current construct}} lt50-note {{used here}}
815 #pragma omp target map(k), map(k[:5]) // lt50-error {{pointer cannot be mapped along with a section derived from itself}} lt50-note {{used here}}
816 foo();
817 #pragma omp target data map(da)
818 #pragma omp target map(da[:4])
819 foo();
820 #pragma omp target data map(k, j, l) // lt50-note {{used here}}
821 #pragma omp target data map(k[:4]) // lt50-error {{pointer cannot be mapped along with a section derived from itself}}
822 #pragma omp target data map(j)
823 #pragma omp target map(l) map(l[:5]) // lt50-error {{variable already marked as mapped in current construct}} lt50-note {{used here}}
824 foo();
825 #pragma omp target data map(k[:4], j, l[:5]) // lt50-note {{used here}}
826 #pragma omp target data map(k) // lt50-error {{pointer cannot be mapped along with a section derived from itself}}
827 #pragma omp target data map(j)
828 #pragma omp target map(l)
829 foo();
831 #pragma omp target data map(always, tofrom: x)
832 #pragma omp target data map(always: x) // expected-error {{missing map type}}
833 // ge51-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
834 // lt51-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
835 // expected-error@+1 {{missing map type}}
836 #pragma omp target data map(tofrom, always: x)
837 #pragma omp target data map(always, tofrom: always, tofrom, x)
838 #pragma omp target map(tofrom j) // expected-error {{expected ',' or ')' in 'map' clause}}
839 foo();
840 #pragma omp target data map(close, tofrom: x)
841 #pragma omp target data map(close: x) // expected-error {{missing map type}}
842 // ge51-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
843 // lt51-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
844 // expected-error@+1 {{missing map type}}
845 #pragma omp target data map(tofrom, close: x)
846 foo();
847 // lt51-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
848 #pragma omp target data map(present, tofrom: x)
849 // ge51-error@+2 {{missing map type}}
850 // lt51-error@+1 {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
851 #pragma omp target data map(present: x)
852 // ge51-error@+4 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
853 // lt51-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
854 // ge51-error@+2 {{missing map type}}
855 // lt51-error@+1 {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
856 #pragma omp target data map(tofrom, present: x)
857 foo();
858 #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}}
860 #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}}
862 #pragma omp target map(m) // warn-warning {{Type 'S6<int>' is not trivially copyable and not guaranteed to be mapped correctly}}
864 #pragma omp target
865 { s.a++; }
866 // lt50-note@+1 {{used here}}
867 #pragma omp target map(s.s.s)
868 // lt50-error@+1 {{variable already marked as mapped in current construct}}
869 { s.a++; }
870 // lt50-note@+1 {{used here}}
871 #pragma omp target map(s.s.s.a)
872 // lt50-error@+1 {{variable already marked as mapped in current construct}}
873 { s.a++; }
874 // lt50-note@+1 {{used here}}
875 #pragma omp target map(s.b[:5])
876 // lt50-error@+1 {{variable already marked as mapped in current construct}}
877 { s.a++; }
878 #pragma omp target map(s.p[:5])
879 { s.a++; }
880 // lt50-note@+1 {{used here}}
881 #pragma omp target map(s.s.sa[3].a)
882 // lt50-error@+1 {{variable already marked as mapped in current construct}}
883 { s.a++; }
884 // lt50-note@+1 {{used here}}
885 #pragma omp target map(s.s.sp[3]->a)
886 // lt50-error@+1 {{variable already marked as mapped in current construct}}
887 { s.a++; }
888 // lt50-note@+1 {{used here}}
889 #pragma omp target map(s.p->a)
890 // lt50-error@+1 {{variable already marked as mapped in current construct}}
891 { s.a++; }
892 // lt50-note@+1 {{used here}}
893 #pragma omp target map(s.s.p->a)
894 // lt50-error@+1 {{variable already marked as mapped in current construct}}
895 { s.a++; }
896 // lt50-note@+1 {{used here}}
897 #pragma omp target map(s.s.s.b[:2])
898 // lt50-error@+1 {{variable already marked as mapped in current construct}}
899 { s.a++; }
900 // lt50-note@+1 {{used here}}
901 #pragma omp target map(s.s.p->b[:2])
902 // lt50-error@+1 {{variable already marked as mapped in current construct}}
903 { s.a++; }
904 // lt50-note@+1 {{used here}}
905 #pragma omp target map(s.p->p->p->a)
906 // lt50-error@+1 {{variable already marked as mapped in current construct}}
907 { s.a++; }
908 #pragma omp target map(s.s.s.b[:2])
909 { s.s.s.b[0]++; }
910 #pragma omp target map(s8[0:1], s9) // warn-warning {{Type 'class S8' is not trivially copyable and not guaranteed to be mapped correctly}} warn-warning {{Type 'class S9' is not trivially copyable and not guaranteed to be mapped correctly}}
913 int **BB, *offset, *a;
915 #pragma omp target map(**(BB+*offset)) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}}
917 #pragma omp target map(**(BB+y)) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}}
919 #pragma omp target map(*(a+*offset)) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}}
921 #pragma omp target map(**(*offset+BB)) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}}
923 #pragma omp target map(**(y+BB)) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}}
925 #pragma omp target map(*(*offset+a)) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}}
927 #pragma omp target map(**(*offset+BB+*a)) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}}
929 #pragma omp target map(**(*(*(&offset))+BB+*a)) // lt50-error {{expected expression containing only member accesses and/or array sections based on named variables}}
931 #pragma omp target map(*(a+(a))) // expected-error {{invalid operands to binary expression ('int *' and 'int *')}}
933 #pragma omp target map(*(1+*a+*a)) // expected-error {{indirection requires pointer operand ('int' invalid)}}
936 #pragma omp target map(delete: a) // expected-error {{map type 'delete' is not allowed for '#pragma omp target'}}
938 #pragma omp target map(release: a) // expected-error {{map type 'release' is not allowed for '#pragma omp target'}}
941 int marr[10][10], iarr[5];
943 #pragma omp target map(marr[10][0:2:2]) // expected-error {{expected ']'}} expected-note {{to match this '['}}
945 #pragma omp target map(iarr[:2:d]) // expected-error {{expected ']'}} expected-note {{to match this '['}}
948 #pragma omp target data map(Arr[0:4]) // lt50-note {{used here}}
950 #pragma omp target
951 Arr[0] = 2; // lt50-error {{original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage}}
954 Array1D<dim> pos;
956 #pragma omp target enter data map(to:pos)
957 #pragma omp target enter data map(to:pos.dptr[0:pos.size])
958 #pragma omp target teams distribute parallel for
959 for(int i=0; i<100; i++) {
960 pos(i).x = i;
961 pos(i).y = i+1;
964 // ge51-ompx-error@+4 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'ompx_hold'}}
965 // lt51-ompx-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'ompx_hold'}}
966 // ge51-omp-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
967 // lt51-omp-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
968 #pragma omp target map(iterator(it=0:10), tofrom:a[it])
971 // ompx-error@+8 {{use of undeclared identifier 'itt'; did you mean 'it'?}}
972 // ompx-note@+7 {{'it' declared here}}
973 // omp-error@+6 {{use of undeclared identifier 'itt'; did you mean 'it'?}}
974 // omp-note@+5 {{'it' declared here}}
975 // ge51-ompx-error@+4 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present', 'ompx_hold'}}
976 // lt51-ompx-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'ompx_hold'}}
977 // ge51-omp-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}}
978 // lt51-omp-error@+1 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}}
979 #pragma omp target map(iterator(it=0:10), tofrom:a[itt])
982 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}}
984 #endif