Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / target_teams_distribute_simd_is_device_ptr_messages.cpp
blob745ebb1fdbb9ddbfb4813a6053392f25c3a1e106
1 // RUN: %clang_cc1 -std=c++11 -verify=expected,omp4 -fopenmp -fopenmp-version=45 %s -Wuninitialized
2 // RUN: %clang_cc1 -std=c++11 -verify -fopenmp %s -Wuninitialized
4 // RUN: %clang_cc1 -std=c++11 -verify=expected,omp4 -fopenmp-simd -fopenmp-version=45 %s -Wuninitialized
5 // RUN: %clang_cc1 -std=c++11 -verify -fopenmp-simd %s -Wuninitialized
6 struct ST {
7 int *a;
8 };
9 typedef int arr[10];
10 typedef ST STarr[10];
11 struct SA {
12 const int d = 5;
13 const int da[5] = { 0 };
14 ST e;
15 ST g[10];
16 STarr &rg = g;
17 int i;
18 int &j = i;
19 int *k = &j;
20 int *&z = k;
21 int aa[10];
22 arr &raa = aa;
23 void func(int arg) {
24 #pragma omp target teams distribute simd is_device_ptr // expected-error {{expected '(' after 'is_device_ptr'}}
25 for (int i=0; i<100; i++)
27 #pragma omp target teams distribute simd is_device_ptr( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
28 for (int i=0; i<100; i++)
30 #pragma omp target teams distribute simd is_device_ptr() // expected-error {{expected expression}}
31 for (int i=0; i<100; i++)
33 #pragma omp target teams distribute simd is_device_ptr(alloc) // expected-error {{use of undeclared identifier 'alloc'}}
34 for (int i=0; i<100; i++)
36 #pragma omp target teams distribute simd is_device_ptr(arg // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
37 for (int i=0; i<100; i++)
39 #pragma omp target teams distribute simd is_device_ptr(i) // expected-error {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
40 for (int i=0; i<100; i++)
42 #pragma omp target teams distribute simd is_device_ptr(j) // expected-error {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
43 for (int i=0; i<100; i++)
45 #pragma omp target teams distribute simd is_device_ptr(k) // OK
46 for (int i=0; i<100; i++)
48 #pragma omp target teams distribute simd is_device_ptr(z) // OK
49 for (int i=0; i<100; i++)
51 #pragma omp target teams distribute simd is_device_ptr(aa) // OK
52 for (int i=0; i<100; i++)
54 #pragma omp target teams distribute simd is_device_ptr(raa) // OK
55 for (int i=0; i<100; i++)
57 #pragma omp target teams distribute simd is_device_ptr(e) // expected-error{{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
58 for (int i=0; i<100; i++)
60 #pragma omp target teams distribute simd is_device_ptr(g) // OK
61 for (int i=0; i<100; i++)
63 #pragma omp target teams distribute simd is_device_ptr(rg) // OK
64 for (int i=0; i<100; i++)
66 #pragma omp target teams distribute simd is_device_ptr(k,i,j) // expected-error2 {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
67 for (int i=0; i<100; i++)
69 #pragma omp target teams distribute simd is_device_ptr(d) // expected-error{{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
70 for (int i=0; i<100; i++)
72 #pragma omp target teams distribute simd is_device_ptr(da) // OK
73 for (int i=0; i<100; i++)
75 return;
78 struct SB {
79 unsigned A;
80 unsigned B;
81 float Arr[100];
82 float *Ptr;
83 float *foo() {
84 return &Arr[0];
88 struct SC {
89 unsigned A : 2;
90 unsigned B : 3;
91 unsigned C;
92 unsigned D;
93 float Arr[100];
94 SB S;
95 SB ArrS[100];
96 SB *PtrS;
97 SB *&RPtrS;
98 float *Ptr;
100 SC(SB *&_RPtrS) : RPtrS(_RPtrS) {}
103 union SD {
104 unsigned A;
105 float B;
108 struct S1;
109 extern S1 a;
110 class S2 {
111 mutable int a;
112 public:
113 S2():a(0) { }
114 S2(S2 &s2):a(s2.a) { }
115 static float S2s;
116 static const float S2sc;
118 const float S2::S2sc = 0;
119 const S2 b;
120 const S2 ba[5];
121 class S3 {
122 int a;
123 public:
124 S3():a(0) { }
125 S3(S3 &s3):a(s3.a) { }
127 const S3 c;
128 const S3 ca[5];
129 extern const int f;
130 class S4 {
131 int a;
132 S4();
133 S4(const S4 &s4);
134 public:
135 S4(int v):a(v) { }
137 class S5 {
138 int a;
139 S5():a(0) {}
140 S5(const S5 &s5):a(s5.a) { }
141 public:
142 S5(int v):a(v) { }
145 S3 h;
146 #pragma omp threadprivate(h)
148 typedef struct {
149 int a;
150 } S6;
152 template <typename T, int I>
153 T tmain(T argc) {
154 const T d = 5;
155 const T da[5] = { 0 };
156 S4 e(4);
157 S5 g(5);
158 S6 h[10];
159 auto &rh = h;
160 T i;
161 T &j = i;
162 T *k = &j;
163 T *&z = k;
164 T aa[10];
165 auto &raa = aa;
166 S6 *ps;
167 #pragma omp target teams distribute simd is_device_ptr // expected-error {{expected '(' after 'is_device_ptr'}}
168 for (int i=0; i<100; i++)
170 #pragma omp target teams distribute simd is_device_ptr( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
171 for (int i=0; i<100; i++)
173 #pragma omp target teams distribute simd is_device_ptr() // expected-error {{expected expression}}
174 for (int i=0; i<100; i++)
176 #pragma omp target teams distribute simd is_device_ptr(alloc) // expected-error {{use of undeclared identifier 'alloc'}}
177 for (int i=0; i<100; i++)
179 #pragma omp target teams distribute simd is_device_ptr(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error{{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
180 for (int i=0; i<100; i++)
182 #pragma omp target teams distribute simd is_device_ptr(i) // expected-error {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
183 for (int i=0; i<100; i++)
185 #pragma omp target teams distribute simd is_device_ptr(j) // expected-error {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
186 for (int i=0; i<100; i++)
188 #pragma omp target teams distribute simd is_device_ptr(k) // OK
189 for (int i=0; i<100; i++)
191 #pragma omp target teams distribute simd is_device_ptr(z) // OK
192 for (int i=0; i<100; i++)
194 #pragma omp target teams distribute simd is_device_ptr(aa) // OK
195 for (int i=0; i<100; i++)
197 #pragma omp target teams distribute simd is_device_ptr(raa) // OK
198 for (int i=0; i<100; i++)
200 #pragma omp target teams distribute simd is_device_ptr(e) // expected-error{{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
201 for (int i=0; i<100; i++)
203 #pragma omp target teams distribute simd is_device_ptr(g) // expected-error{{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
204 for (int i=0; i<100; i++)
206 #pragma omp target teams distribute simd is_device_ptr(h) // OK
207 for (int i=0; i<100; i++)
209 #pragma omp target teams distribute simd is_device_ptr(rh) // OK
210 for (int i=0; i<100; i++)
212 #pragma omp target teams distribute simd is_device_ptr(k,i,j) // expected-error2 {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
213 for (int i=0; i<100; i++)
215 #pragma omp target teams distribute simd is_device_ptr(d) // expected-error{{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
216 for (int i=0; i<100; i++)
218 #pragma omp target teams distribute simd is_device_ptr(da) // OK
219 for (int i=0; i<100; i++)
221 #pragma omp target teams distribute simd map(ps) is_device_ptr(ps) // expected-error{{variable already marked as mapped in current construct}} expected-note{{used here}}
222 for (int i=0; i<100; i++)
224 #pragma omp target teams distribute simd is_device_ptr(ps) map(ps) // expected-error{{variable already marked as mapped in current construct}} expected-note{{used here}}
225 for (int i=0; i<100; i++)
227 #pragma omp target teams distribute simd map(ps->a) is_device_ptr(ps) // expected-error{{variable already marked as mapped in current construct}} expected-note{{used here}}
228 for (int i=0; i<100; i++)
230 #pragma omp target teams distribute simd is_device_ptr(ps) map(ps->a) // expected-error{{pointer cannot be mapped along with a section derived from itself}} expected-note{{used here}}
231 for (int i=0; i<100; i++)
233 #pragma omp target teams distribute simd is_device_ptr(ps) firstprivate(ps) // omp4-error{{firstprivate variable cannot be in a is_device_ptr clause in '#pragma omp target teams distribute simd' directive}}
234 for (int i=0; i<100; i++)
236 #pragma omp target teams distribute simd firstprivate(ps) is_device_ptr(ps) // expected-error{{firstprivate variable cannot be in a is_device_ptr clause in '#pragma omp target teams distribute simd' directive}} expected-note{{defined as firstprivate}}
237 for (int i=0; i<100; i++)
239 #pragma omp target teams distribute simd is_device_ptr(ps) private(ps) // omp4-error{{private variable cannot be in a is_device_ptr clause in '#pragma omp target teams distribute simd' directive}}
240 for (int i=0; i<100; i++)
242 #pragma omp target teams distribute simd private(ps) is_device_ptr(ps) // expected-error{{private variable cannot be in a is_device_ptr clause in '#pragma omp target teams distribute simd' directive}} expected-note{{defined as private}}
243 for (int i=0; i<100; i++)
245 return 0;
248 int main(int argc, char **argv) {
249 const int d = 5;
250 const int da[5] = { 0 };
251 S4 e(4);
252 S5 g(5);
253 S6 h[10];
254 auto &rh = h;
255 int i;
256 int &j = i;
257 int *k = &j;
258 int *&z = k;
259 int aa[10];
260 auto &raa = aa;
261 S6 *ps;
262 #pragma omp target teams distribute simd is_device_ptr // expected-error {{expected '(' after 'is_device_ptr'}}
263 for (int i=0; i<100; i++)
265 #pragma omp target teams distribute simd is_device_ptr( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
266 for (int i=0; i<100; i++)
268 #pragma omp target teams distribute simd is_device_ptr() // expected-error {{expected expression}}
269 for (int i=0; i<100; i++)
271 #pragma omp target teams distribute simd is_device_ptr(alloc) // expected-error {{use of undeclared identifier 'alloc'}}
272 for (int i=0; i<100; i++)
274 #pragma omp target teams distribute simd is_device_ptr(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
275 for (int i=0; i<100; i++)
277 #pragma omp target teams distribute simd is_device_ptr(i) // expected-error {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
278 for (int i=0; i<100; i++)
280 #pragma omp target teams distribute simd is_device_ptr(j) // expected-error {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
281 for (int i=0; i<100; i++)
283 #pragma omp target teams distribute simd is_device_ptr(k) // OK
284 for (int i=0; i<100; i++)
286 #pragma omp target teams distribute simd is_device_ptr(z) // OK
287 for (int i=0; i<100; i++)
289 #pragma omp target teams distribute simd is_device_ptr(aa) // OK
290 for (int i=0; i<100; i++)
292 #pragma omp target teams distribute simd is_device_ptr(raa) // OK
293 for (int i=0; i<100; i++)
295 #pragma omp target teams distribute simd is_device_ptr(e) // expected-error{{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
296 for (int i=0; i<100; i++)
298 #pragma omp target teams distribute simd is_device_ptr(g) // expected-error{{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
299 for (int i=0; i<100; i++)
301 #pragma omp target teams distribute simd is_device_ptr(h) // OK
302 for (int i=0; i<100; i++)
304 #pragma omp target teams distribute simd is_device_ptr(rh) // OK
305 for (int i=0; i<100; i++)
307 #pragma omp target teams distribute simd is_device_ptr(k,i,j) // expected-error2 {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
308 for (int i=0; i<100; i++)
310 #pragma omp target teams distribute simd is_device_ptr(d) // expected-error{{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
311 for (int i=0; i<100; i++)
313 #pragma omp target teams distribute simd is_device_ptr(da) // OK
314 for (int i=0; i<100; i++)
316 #pragma omp target teams distribute simd map(ps) is_device_ptr(ps) // expected-error{{variable already marked as mapped in current construct}} expected-note{{used here}}
317 for (int i=0; i<100; i++)
319 #pragma omp target teams distribute simd is_device_ptr(ps) map(ps) // expected-error{{variable already marked as mapped in current construct}} expected-note{{used here}}
320 for (int i=0; i<100; i++)
322 #pragma omp target teams distribute simd map(ps->a) is_device_ptr(ps) // expected-error{{variable already marked as mapped in current construct}} expected-note{{used here}}
323 for (int i=0; i<100; i++)
325 #pragma omp target teams distribute simd is_device_ptr(ps) map(ps->a) // expected-error{{pointer cannot be mapped along with a section derived from itself}} expected-note{{used here}}
326 for (int i=0; i<100; i++)
328 #pragma omp target teams distribute simd is_device_ptr(ps) firstprivate(ps) // omp4-error{{firstprivate variable cannot be in a is_device_ptr clause in '#pragma omp target teams distribute simd' directive}}
329 for (int i=0; i<100; i++)
331 #pragma omp target teams distribute simd firstprivate(ps) is_device_ptr(ps) // expected-error{{firstprivate variable cannot be in a is_device_ptr clause in '#pragma omp target teams distribute simd' directive}} expected-note{{defined as firstprivate}}
332 for (int i=0; i<100; i++)
334 #pragma omp target teams distribute simd is_device_ptr(ps) private(ps) // omp4-error{{private variable cannot be in a is_device_ptr clause in '#pragma omp target teams distribute simd' directive}}
335 for (int i=0; i<100; i++)
337 #pragma omp target teams distribute simd private(ps) is_device_ptr(ps) // expected-error{{private variable cannot be in a is_device_ptr clause in '#pragma omp target teams distribute simd' directive}} expected-note{{defined as private}}
338 for (int i=0; i<100; i++)
340 return tmain<int, 3>(argc); // expected-note {{in instantiation of function template specialization 'tmain<int, 3>' requested here}}