]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/OpenMP/target_teams_distribute_parallel_for_simd_map_messages.cpp
Vendor import of clang trunk r351319 (just before the release_80 branch
[FreeBSD/FreeBSD.git] / test / OpenMP / target_teams_distribute_parallel_for_simd_map_messages.cpp
1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wno-openmp-target
2
3 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wno-openmp-target
4
5 void foo() {
6 }
7
8 bool foobool(int argc) {
9   return argc;
10 }
11
12 struct S1; // expected-note 2 {{declared here}}
13 extern S1 a;
14 class S2 {
15   mutable int a;
16 public:
17   S2():a(0) { }
18   S2(S2 &s2):a(s2.a) { }
19   static float S2s;
20   static const float S2sc;
21 };
22 const float S2::S2sc = 0;
23 const S2 b;
24 const S2 ba[5];
25 class S3 {
26   int a;
27 public:
28   S3():a(0) { }
29   S3(S3 &s3):a(s3.a) { }
30 };
31 const S3 c;
32 const S3 ca[5];
33 extern const int f;
34 class S4 {
35   int a;
36   S4();
37   S4(const S4 &s4);
38 public:
39   S4(int v):a(v) { }
40 };
41 class S5 {
42   int a;
43   S5():a(0) {}
44   S5(const S5 &s5):a(s5.a) { }
45 public:
46   S5(int v):a(v) { }
47 };
48
49 S3 h;
50 #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
51
52 typedef int from;
53
54 template <typename T, int I> // expected-note {{declared here}}
55 T tmain(T argc) {
56   const T d = 5;
57   const T da[5] = { 0 };
58   S4 e(4);
59   S5 g(5);
60   T i, t[20];
61   T &j = i;
62   T *k = &j;
63   T x;
64   T y;
65   T to, tofrom, always;
66   const T (&l)[5] = da;
67
68
69 #pragma omp target teams distribute parallel for simd map // expected-error {{expected '(' after 'map'}}
70   for (i = 0; i < argc; ++i) foo();
71 #pragma omp target teams distribute parallel for simd map( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
72   for (i = 0; i < argc; ++i) foo();
73 #pragma omp target teams distribute parallel for simd map() // expected-error {{expected expression}}
74   for (i = 0; i < argc; ++i) foo();
75 #pragma omp target teams distribute parallel for simd map(alloc) // expected-error {{use of undeclared identifier 'alloc'}}
76   for (i = 0; i < argc; ++i) foo();
77 #pragma omp target teams distribute parallel for simd map(to argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 'map' clause}}
78   for (i = 0; i < argc; ++i) foo();
79 #pragma omp target teams distribute parallel for simd map(to:) // expected-error {{expected expression}}
80   for (i = 0; i < argc; ++i) foo();
81 #pragma omp target teams distribute parallel for simd map(from: argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
82   for (i = 0; i < argc; ++i) foo();
83 #pragma omp target teams distribute parallel for simd map(x: y) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
84   for (i = 0; i < argc; ++i) foo();
85 #pragma omp target teams distribute parallel for simd map(l[-1:]) // expected-error 2 {{array section must be a subset of the original array}}
86   for (i = 0; i < argc; ++i) foo();
87 #pragma omp target teams distribute parallel for simd map(l[:-1]) // expected-error 2 {{section length is evaluated to a negative value -1}}
88   for (i = 0; i < argc; ++i) foo();
89 #pragma omp target teams distribute parallel for simd map(x)
90   for (i = 0; i < argc; ++i) foo();
91 #pragma omp target teams distribute parallel for simd map(tofrom: t[:I])
92   for (i = 0; i < argc; ++i) foo();
93 #pragma omp target teams distribute parallel for simd 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}}
94   for (i = 0; i < argc; ++i) foo();
95 #pragma omp target teams distribute parallel for simd map(T) // expected-error {{'T' does not refer to a value}}
96   for (i = 0; i < argc; ++i) foo();
97 #pragma omp target teams distribute parallel for simd map(I) // expected-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}}
98   for (i = 0; i < argc; ++i) foo();
99 #pragma omp target teams distribute parallel for simd map(S2::S2s)
100   for (i = 0; i < argc; ++i) foo();
101 #pragma omp target teams distribute parallel for simd map(S2::S2sc)
102   for (i = 0; i < argc; ++i) foo();
103 #pragma omp target teams distribute parallel for simd map(x)
104   for (i = 0; i < argc; ++i) foo();
105 #pragma omp target teams distribute parallel for simd map(to: x)
106   for (i = 0; i < argc; ++i) foo();
107 #pragma omp target teams distribute parallel for simd map(to: to)
108   for (i = 0; i < argc; ++i) foo();
109 #pragma omp target teams distribute parallel for simd map(to)
110   for (i = 0; i < argc; ++i) foo();
111 #pragma omp target teams distribute parallel for simd map(to, x)
112   for (i = 0; i < argc; ++i) foo();
113 #pragma omp target teams distribute parallel for simd map(to x) // expected-error {{expected ',' or ')' in 'map' clause}}
114   for (i = 0; i < argc; ++i) foo();
115 #pragma omp target teams distribute parallel for simd map(tofrom: argc > 0 ? x : y) // expected-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}} 
116   for (i = 0; i < argc; ++i) foo();
117 #pragma omp target teams distribute parallel for simd map(argc)
118   for (i = 0; i < argc; ++i) foo();
119 #pragma omp target teams distribute parallel for simd map(S1) // expected-error {{'S1' does not refer to a value}}
120   for (i = 0; i < argc; ++i) foo();
121 #pragma omp target teams distribute parallel for simd map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
122   for (i = 0; i < argc; ++i) foo();
123 #pragma omp target teams distribute parallel for simd map(ba)
124   for (i = 0; i < argc; ++i) foo();
125 #pragma omp target teams distribute parallel for simd map(ca)
126   for (i = 0; i < argc; ++i) foo();
127 #pragma omp target teams distribute parallel for simd map(da)
128   for (i = 0; i < argc; ++i) foo();
129 #pragma omp target teams distribute parallel for simd map(S2::S2s)
130   for (i = 0; i < argc; ++i) foo();
131 #pragma omp target teams distribute parallel for simd map(S2::S2sc)
132   for (i = 0; i < argc; ++i) foo();
133 #pragma omp target teams distribute parallel for simd map(e, g)
134   for (i = 0; i < argc; ++i) foo();
135 #pragma omp target teams distribute parallel for simd map(h) // expected-error {{threadprivate variables are not allowed in 'map' clause}}
136   for (i = 0; i < argc; ++i) foo();
137 #pragma omp target teams distribute parallel for simd map(k), map(k) // expected-error 2 {{variable already marked as mapped in current construct}} expected-note 2 {{used here}}
138   for (i = 0; i < argc; ++i) foo();
139 #pragma omp target teams distribute parallel for simd map(k), map(k[:5]) // expected-error 2 {{pointer cannot be mapped along with a section derived from itself}} expected-note 2 {{used here}}
140   for (i = 0; i < argc; ++i) foo();
141 #pragma omp target teams distribute parallel for simd map(da)
142   for (i = 0; i < argc; ++i) foo();
143 #pragma omp target teams distribute parallel for simd map(da[:4])
144   for (i = 0; i < argc; ++i) foo();
145 #pragma omp target data map(k, j, l) // expected-note 2 {{used here}}
146 #pragma omp target teams distribute parallel for simd map(k[:4]) // expected-error 2 {{pointer cannot be mapped along with a section derived from itself}}
147   for (i = 0; i < argc; ++i) foo();
148 #pragma omp target teams distribute parallel for simd map(j)
149   for (i = 0; i < argc; ++i) foo();
150 #pragma omp target teams distribute parallel for simd map(l) map(l[:5]) // expected-error 2 {{variable already marked as mapped in current construct}} expected-note 2 {{used here}}
151   for (i = 0; i < argc; ++i) foo();
152 #pragma omp target data map(k[:4], j, l[:5]) // expected-note 2 {{used here}}
153 {
154 #pragma omp target teams distribute parallel for simd map(k) // expected-error 2 {{pointer cannot be mapped along with a section derived from itself}}
155   for (i = 0; i < argc; ++i) foo();
156 #pragma omp target teams distribute parallel for simd map(j)
157   for (i = 0; i < argc; ++i) foo();
158 #pragma omp target teams distribute parallel for simd map(l)
159   for (i = 0; i < argc; ++i) foo();
160 }
161
162 #pragma omp target teams distribute parallel for simd map(always, tofrom: x)
163   for (i = 0; i < argc; ++i) foo();
164 #pragma omp target teams distribute parallel for simd map(always: x) // expected-error {{missing map type}}
165   for (i = 0; i < argc; ++i) foo();
166 #pragma omp target teams distribute parallel for simd map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}}
167   for (i = 0; i < argc; ++i) foo();
168 #pragma omp target teams distribute parallel for simd map(always, tofrom: always, tofrom, x)
169   for (i = 0; i < argc; ++i) foo();
170 #pragma omp target teams distribute parallel for simd map(tofrom j) // expected-error {{expected ',' or ')' in 'map' clause}}
171   for (i = 0; i < argc; ++i) foo();
172
173   return 0;
174 }
175
176 int main(int argc, char **argv) {
177   const int d = 5;
178   const int da[5] = { 0 };
179   S4 e(4);
180   S5 g(5);
181   int i;
182   int &j = i;
183   int *k = &j;
184   int x;
185   int y;
186   int to, tofrom, always;
187   const int (&l)[5] = da;
188
189 #pragma omp target teams distribute parallel for simd map // expected-error {{expected '(' after 'map'}}
190   for (i = 0; i < argc; ++i) foo();
191 #pragma omp target teams distribute parallel for simd map( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
192   for (i = 0; i < argc; ++i) foo();
193 #pragma omp target teams distribute parallel for simd map() // expected-error {{expected expression}}
194   for (i = 0; i < argc; ++i) foo();
195 #pragma omp target teams distribute parallel for simd map(alloc) // expected-error {{use of undeclared identifier 'alloc'}}
196   for (i = 0; i < argc; ++i) foo();
197 #pragma omp target teams distribute parallel for simd map(to argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 'map' clause}}
198   for (i = 0; i < argc; ++i) foo();
199 #pragma omp target teams distribute parallel for simd map(to:) // expected-error {{expected expression}}
200   for (i = 0; i < argc; ++i) foo();
201 #pragma omp target teams distribute parallel for simd map(from: argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
202   for (i = 0; i < argc; ++i) foo();
203 #pragma omp target teams distribute parallel for simd map(x: y) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}}
204   for (i = 0; i < argc; ++i) foo();
205 #pragma omp target teams distribute parallel for simd map(l[-1:]) // expected-error {{array section must be a subset of the original array}}
206   for (i = 0; i < argc; ++i) foo();
207 #pragma omp target teams distribute parallel for simd map(l[:-1]) // expected-error {{section length is evaluated to a negative value -1}}
208   for (i = 0; i < argc; ++i) foo();
209 #pragma omp target teams distribute parallel for simd map(x)
210   for (i = 0; i < argc; ++i) foo();
211 #pragma omp target teams distribute parallel for simd map(to: x)
212   for (i = 0; i < argc; ++i) foo();
213 #pragma omp target teams distribute parallel for simd map(to: to)
214   for (i = 0; i < argc; ++i) foo();
215 #pragma omp target teams distribute parallel for simd map(to)
216   for (i = 0; i < argc; ++i) foo();
217 #pragma omp target teams distribute parallel for simd map(to, x)
218   for (i = 0; i < argc; ++i) foo();
219 #pragma omp target teams distribute parallel for simd map(to x) // expected-error {{expected ',' or ')' in 'map' clause}}
220   for (i = 0; i < argc; ++i) foo();
221 #pragma omp target teams distribute parallel for simd map(tofrom: argc > 0 ? argv[1] : argv[2]) // expected-error {{expected expression containing only member accesses and/or array sections based on named variables}}
222   for (i = 0; i < argc; ++i) foo();
223 #pragma omp target teams distribute parallel for simd map(argc)
224   for (i = 0; i < argc; ++i) foo();
225 #pragma omp target teams distribute parallel for simd map(S1) // expected-error {{'S1' does not refer to a value}}
226   for (i = 0; i < argc; ++i) foo();
227 #pragma omp target teams distribute parallel for simd map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
228   for (i = 0; i < argc; ++i) foo();
229 #pragma omp target teams distribute parallel for simd map(argv[1])
230   for (i = 0; i < argc; ++i) foo();
231 #pragma omp target teams distribute parallel for simd map(ba)
232   for (i = 0; i < argc; ++i) foo();
233 #pragma omp target teams distribute parallel for simd map(ca)
234   for (i = 0; i < argc; ++i) foo();
235 #pragma omp target teams distribute parallel for simd map(da)
236   for (i = 0; i < argc; ++i) foo();
237 #pragma omp target teams distribute parallel for simd map(S2::S2s)
238   for (i = 0; i < argc; ++i) foo();
239 #pragma omp target teams distribute parallel for simd map(S2::S2sc)
240   for (i = 0; i < argc; ++i) foo();
241 #pragma omp target teams distribute parallel for simd map(e, g)
242   for (i = 0; i < argc; ++i) foo();
243 #pragma omp target teams distribute parallel for simd map(h) // expected-error {{threadprivate variables are not allowed in 'map' clause}}
244   for (i = 0; i < argc; ++i) foo();
245 #pragma omp target teams distribute parallel for simd map(k), map(k) // expected-error {{variable already marked as mapped in current construct}} expected-note {{used here}}
246   for (i = 0; i < argc; ++i) foo();
247 #pragma omp target teams distribute parallel for simd map(k), map(k[:5]) // expected-error {{pointer cannot be mapped along with a section derived from itself}} expected-note {{used here}}
248   for (i = 0; i < argc; ++i) foo();
249 #pragma omp target teams distribute parallel for simd map(da)
250   for (i = 0; i < argc; ++i) foo();
251 #pragma omp target teams distribute parallel for simd map(da[:4])
252   for (i = 0; i < argc; ++i) foo();
253 #pragma omp target data map(k, j, l) // expected-note {{used here}}
254 #pragma omp target teams distribute parallel for simd map(k[:4]) // expected-error {{pointer cannot be mapped along with a section derived from itself}}
255   for (i = 0; i < argc; ++i) foo();
256 #pragma omp target teams distribute parallel for simd map(j)
257   for (i = 0; i < argc; ++i) foo();
258 #pragma omp target teams distribute parallel for simd map(l) map(l[:5]) // expected-error 1 {{variable already marked as mapped in current construct}} expected-note 1 {{used here}}
259   for (i = 0; i < argc; ++i) foo();
260 #pragma omp target data map(k[:4], j, l[:5]) // expected-note {{used here}}
261 {
262 #pragma omp target teams distribute parallel for simd map(k) // expected-error {{pointer cannot be mapped along with a section derived from itself}}
263   for (i = 0; i < argc; ++i) foo();
264 #pragma omp target teams distribute parallel for simd map(j)
265   for (i = 0; i < argc; ++i) foo();
266 #pragma omp target teams distribute parallel for simd map(l)
267   for (i = 0; i < argc; ++i) foo();
268 }
269
270 #pragma omp target teams distribute parallel for simd map(always, tofrom: x)
271   for (i = 0; i < argc; ++i) foo();
272 #pragma omp target teams distribute parallel for simd map(always: x) // expected-error {{missing map type}}
273   for (i = 0; i < argc; ++i) foo();
274 #pragma omp target teams distribute parallel for simd map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}}
275   for (i = 0; i < argc; ++i) foo();
276 #pragma omp target teams distribute parallel for simd map(always, tofrom: always, tofrom, x)
277   for (i = 0; i < argc; ++i) foo();
278 #pragma omp target teams distribute parallel for simd map(tofrom j) // expected-error {{expected ',' or ')' in 'map' clause}}
279   for (i = 0; i < argc; ++i) foo();
280
281   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}}
282 }
283