1 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -ferror-limit 150 -o - %s -Wno-openmp-mapping -Wuninitialized
2 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -std=c++98 -ferror-limit 150 -o - %s -Wno-openmp-mapping -Wuninitialized
3 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -std=c++11 -ferror-limit 150 -o - %s -Wno-openmp-mapping -Wuninitialized
4 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -ferror-limit 150 -o - %s -Wno-openmp-mapping -Wuninitialized
5 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -std=c++98 -ferror-limit 150 -o - %s -Wno-openmp-mapping -Wuninitialized
6 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -std=c++11 -ferror-limit 150 -o - %s -Wno-openmp-mapping -Wuninitialized
7
8 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -ferror-limit 150 -o - %s -Wno-openmp-mapping -Wuninitialized
9 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -std=c++98 -ferror-limit 150 -o - %s -Wno-openmp-mapping -Wuninitialized
10 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -std=c++11 -ferror-limit 150 -o - %s -Wno-openmp-mapping -Wuninitialized
11 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -ferror-limit 150 -o - %s -Wno-openmp-mapping -Wuninitialized
12 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s -Wno-openmp-mapping -Wuninitialized
13 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s -Wno-openmp-mapping -Wuninitialized
14
15 extern int omp_default_mem_alloc;
xxx(int argc)16 void xxx(int argc) {
17 int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
18 #pragma omp distribute parallel for simd reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
19 for (int i = 0; i < 10; ++i)
20 ;
21 }
22
foo()23 void foo() {
24 }
25
foobool(int argc)26 bool foobool(int argc) {
27 return argc;
28 }
29
foobar(int & ref)30 void foobar(int &ref) {
31 #pragma omp target
32 #pragma omp teams
33 #pragma omp distribute parallel for simd reduction(+:ref)
34 for (int i = 0; i < 10; ++i)
35 foo();
36 }
37
38 struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
39 extern S1 a;
40 class S2 {
41 mutable int a;
operator +(const S2 & arg)42 S2 &operator+(const S2 &arg) { return (*this); } // expected-note 3 {{implicitly declared private here}}
43
44 public:
S2()45 S2() : a(0) {}
S2(S2 & s2)46 S2(S2 &s2) : a(s2.a) {}
47 static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
48 static const float S2sc; // expected-note 2 {{'S2sc' declared here}}
49 };
50 const float S2::S2sc = 0;
51 S2 b; // expected-note 3 {{'b' defined here}}
52 const S2 ba[5]; // expected-note 2 {{'ba' defined here}}
53 class S3 {
54 int a;
55
56 public:
57 int b;
S3()58 S3() : a(0) {}
S3(const S3 & s3)59 S3(const S3 &s3) : a(s3.a) {}
operator +(const S3 & arg1)60 S3 operator+(const S3 &arg1) { return arg1; }
61 };
operator +(const S3 & arg1,const S3 & arg2)62 int operator+(const S3 &arg1, const S3 &arg2) { return 5; }
63 S3 c; // expected-note 3 {{'c' defined here}}
64 const S3 ca[5]; // expected-note 2 {{'ca' defined here}}
65 extern const int f; // expected-note 4 {{'f' declared here}}
66 class S4 {
67 int a;
68 S4(); // expected-note {{implicitly declared private here}}
69 S4(const S4 &s4);
operator +(const S4 & arg)70 S4 &operator+(const S4 &arg) { return (*this); }
71
72 public:
S4(int v)73 S4(int v) : a(v) {}
74 };
operator &=(S4 & arg1,S4 & arg2)75 S4 &operator&=(S4 &arg1, S4 &arg2) { return arg1; }
76 class S5 {
77 int a;
S5()78 S5() : a(0) {} // expected-note {{implicitly declared private here}}
S5(const S5 & s5)79 S5(const S5 &s5) : a(s5.a) {}
80 S5 &operator+(const S5 &arg);
81
82 public:
S5(int v)83 S5(int v) : a(v) {}
84 };
85 class S6 { // expected-note 3 {{candidate function (the implicit copy assignment operator) not viable: no known conversion from 'int' to 'const S6' for 1st argument}}
86 #if __cplusplus >= 201103L // C++11 or later
87 // expected-note@-2 3 {{candidate function (the implicit move assignment operator) not viable}}
88 #endif
89 int a;
90
91 public:
S6()92 S6() : a(6) {}
operator int()93 operator int() { return 6; }
94 } o;
95
96 S3 h, k;
97 #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
98
99 template <class T> // expected-note {{declared here}}
tmain(T argc)100 T tmain(T argc) {
101 const T d = T(); // expected-note 4 {{'d' defined here}}
102 const T da[5] = {T()}; // expected-note 2 {{'da' defined here}}
103 T qa[5] = {T()};
104 T i, z;
105 T &j = i; // expected-note 4 {{'j' defined here}}
106 S3 &p = k; // expected-note 2 {{'p' defined here}}
107 const T &r = da[(int)i]; // expected-note 2 {{'r' defined here}}
108 T &q = qa[(int)i]; // expected-note 2 {{'q' defined here}}
109 T fl;
110 #pragma omp target
111 #pragma omp teams
112 #pragma omp distribute parallel for simd reduction // expected-error {{expected '(' after 'reduction'}}
113 for (int i = 0; i < 10; ++i)
114 foo();
115 #pragma omp target
116 #pragma omp teams
117 #pragma omp distribute parallel for simd reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}}
118 for (int i = 0; i < 10; ++i)
119 foo();
120 #pragma omp target
121 #pragma omp teams
122 #pragma omp distribute parallel for simd reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
123 for (int i = 0; i < 10; ++i)
124 foo();
125 #pragma omp target
126 #pragma omp teams
127 #pragma omp distribute parallel for simd reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
128 for (int i = 0; i < 10; ++i)
129 foo();
130 #pragma omp target
131 #pragma omp teams
132 #pragma omp distribute parallel for simd reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
133 for (int i = 0; i < 10; ++i)
134 foo();
135 #pragma omp target
136 #pragma omp teams
137 #pragma omp distribute parallel for simd reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}}
138 for (int i = 0; i < 10; ++i)
139 foo();
140 #pragma omp target
141 #pragma omp teams
142 #pragma omp distribute parallel for simd reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
143 for (int i = 0; i < 10; ++i)
144 foo();
145 #pragma omp target
146 #pragma omp teams
147 #pragma omp distribute parallel for simd reduction(& : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{invalid operands to binary expression ('float' and 'float')}}
148 for (int i = 0; i < 10; ++i)
149 foo();
150 #pragma omp target
151 #pragma omp teams
152 #pragma omp distribute parallel for simd reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{invalid operands to binary expression ('float' and 'float')}}
153 for (int i = 0; i < 10; ++i)
154 foo();
155 #pragma omp target
156 #pragma omp teams
157 #pragma omp distribute parallel for simd reduction(|| : argc ? i : argc) // expected-error 2 {{expected variable name, array element or array section}}
158 for (int i = 0; i < 10; ++i)
159 foo();
160 #pragma omp target
161 #pragma omp teams
162 #pragma omp distribute parallel for simd reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}}
163 for (int i = 0; i < 10; ++i)
164 foo();
165 #pragma omp target
166 #pragma omp teams
167 #pragma omp distribute parallel for simd reduction(&& : argc, z)
168 for (int i = 0; i < 10; ++i)
169 foo();
170 #pragma omp target
171 #pragma omp teams
172 #pragma omp distribute parallel for simd reduction(^ : T) // expected-error {{'T' does not refer to a value}}
173 for (int i = 0; i < 10; ++i)
174 foo();
175 #pragma omp target
176 #pragma omp teams
177 #pragma omp distribute parallel for simd reduction(+ : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 3 {{const-qualified variable cannot be reduction}} expected-error 2 {{'operator+' is a private member of 'S2'}}
178 for (int i = 0; i < 10; ++i)
179 foo();
180 #pragma omp target
181 #pragma omp teams
182 #pragma omp distribute parallel for simd reduction(min : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 4 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 3 {{const-qualified variable cannot be reduction}}
183 for (int i = 0; i < 10; ++i)
184 foo();
185 #pragma omp target
186 #pragma omp teams
187 #pragma omp distribute parallel for simd reduction(max : h.b) // expected-error {{expected variable name, array element or array section}}
188 for (int i = 0; i < 10; ++i)
189 foo();
190 #pragma omp target
191 #pragma omp teams
192 #pragma omp distribute parallel for simd reduction(+ : ba) // expected-error {{const-qualified variable cannot be reduction}}
193 for (int i = 0; i < 10; ++i)
194 foo();
195 #pragma omp target
196 #pragma omp teams
197 #pragma omp distribute parallel for simd reduction(* : ca) // expected-error {{const-qualified variable cannot be reduction}}
198 for (int i = 0; i < 10; ++i)
199 foo();
200 #pragma omp target
201 #pragma omp teams
202 #pragma omp distribute parallel for simd reduction(- : da) // expected-error {{const-qualified variable cannot be reduction}} expected-error {{const-qualified variable cannot be reduction}}
203 for (int i = 0; i < 10; ++i)
204 foo();
205 #pragma omp target
206 #pragma omp teams
207 #pragma omp distribute parallel for simd reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
208 for (int i = 0; i < 10; ++i)
209 foo();
210 #pragma omp target
211 #pragma omp teams
212 #pragma omp distribute parallel for simd reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
213 for (int i = 0; i < 10; ++i)
214 foo();
215 #pragma omp target
216 #pragma omp teams
217 #pragma omp distribute parallel for simd reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
218 for (int i = 0; i < 10; ++i)
219 foo();
220 #pragma omp target
221 #pragma omp teams
222 #pragma omp distribute parallel for simd reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}}
223 for (int i = 0; i < 10; ++i)
224 foo();
225 #pragma omp target
226 #pragma omp teams
227 #pragma omp distribute parallel for simd reduction(+ : o) // expected-error 2 {{no viable overloaded '='}}
228 for (int i = 0; i < 10; ++i)
229 foo();
230 #pragma omp target
231 #pragma omp teams
232 #pragma omp distribute parallel for simd private(i), reduction(+ : j), reduction(+ : q) // expected-error 4 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
233 for (int i = 0; i < 10; ++i)
234 foo();
235 #pragma omp parallel private(k)
236 #pragma omp target
237 #pragma omp teams
238 #pragma omp distribute parallel for simd reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
239 for (int i = 0; i < 10; ++i)
240 foo();
241 #pragma omp target
242 #pragma omp teams
243 #pragma omp distribute parallel for simd reduction(+ : p), reduction(+ : p) // expected-error 2 {{variable can appear only once in OpenMP 'reduction' clause}} expected-note 2 {{previously referenced here}}
244 for (int i = 0; i < 10; ++i)
245 foo();
246 #pragma omp target
247 #pragma omp teams
248 #pragma omp distribute parallel for simd reduction(+ : r) // expected-error 2 {{const-qualified variable cannot be reduction}}
249 for (int i = 0; i < 10; ++i)
250 foo();
251 #pragma omp parallel shared(i)
252 #pragma omp parallel reduction(min : i)
253 #pragma omp target
254 #pragma omp teams
255 #pragma omp distribute parallel for simd reduction(max : j) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
256 for (int i = 0; i < 10; ++i)
257 foo();
258 #pragma omp parallel private(fl)
259 #pragma omp target
260 #pragma omp teams
261 #pragma omp distribute parallel for simd reduction(+ : fl)
262 for (int i = 0; i < 10; ++i)
263 foo();
264 #pragma omp parallel reduction(* : fl)
265 #pragma omp target
266 #pragma omp teams
267 #pragma omp distribute parallel for simd reduction(+ : fl)
268 for (int i = 0; i < 10; ++i)
269 foo();
270
271 return T();
272 }
273
274 namespace A {
275 double x;
276 #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
277 }
278 namespace B {
279 using A::x;
280 }
281
main(int argc,char ** argv)282 int main(int argc, char **argv) {
283 const int d = 5; // expected-note 2 {{'d' defined here}}
284 const int da[5] = {0}; // expected-note {{'da' defined here}}
285 int qa[5] = {0};
286 S4 e(4);
287 S5 g(5);
288 int i, z;
289 int &j = i; // expected-note 2 {{'j' defined here}}
290 S3 &p = k; // expected-note 2 {{'p' defined here}}
291 const int &r = da[i]; // expected-note {{'r' defined here}}
292 int &q = qa[i]; // expected-note {{'q' defined here}}
293 float fl;
294 #pragma omp target
295 #pragma omp teams
296 #pragma omp distribute parallel for simd reduction // expected-error {{expected '(' after 'reduction'}}
297 for (int i = 0; i < 10; ++i)
298 foo();
299 #pragma omp target
300 #pragma omp teams
301 #pragma omp distribute parallel for simd reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}}
302 for (int i = 0; i < 10; ++i)
303 foo();
304 #pragma omp target
305 #pragma omp teams
306 #pragma omp distribute parallel for simd reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
307 for (int i = 0; i < 10; ++i)
308 foo();
309 #pragma omp target
310 #pragma omp teams
311 #pragma omp distribute parallel for simd reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
312 for (int i = 0; i < 10; ++i)
313 foo();
314 #pragma omp target
315 #pragma omp teams
316 #pragma omp distribute parallel for simd reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
317 for (int i = 0; i < 10; ++i)
318 foo();
319 #pragma omp target
320 #pragma omp teams
321 #pragma omp distribute parallel for simd reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}}
322 for (int i = 0; i < 10; ++i)
323 foo();
324 #pragma omp target
325 #pragma omp teams
326 #pragma omp distribute parallel for simd reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
327 for (int i = 0; i < 10; ++i)
328 foo();
329 #pragma omp target
330 #pragma omp teams
331 #pragma omp distribute parallel for simd reduction(foo : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max'}}
332 for (int i = 0; i < 10; ++i)
333 foo();
334 #pragma omp target
335 #pragma omp teams
336 #pragma omp distribute parallel for simd reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
337 for (int i = 0; i < 10; ++i)
338 foo();
339 #pragma omp target
340 #pragma omp teams
341 #pragma omp distribute parallel for simd reduction(|| : argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name, array element or array section}}
342 for (int i = 0; i < 10; ++i)
343 foo();
344 #pragma omp target
345 #pragma omp teams
346 #pragma omp distribute parallel for simd reduction(~ : argc) // expected-error {{expected unqualified-id}}
347 for (int i = 0; i < 10; ++i)
348 foo();
349 #pragma omp target
350 #pragma omp teams
351 #pragma omp distribute parallel for simd reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
352 for (int i = 0; i < 10; ++i)
353 foo();
354 #pragma omp target
355 #pragma omp teams
356 #pragma omp distribute parallel for simd reduction(^ : S1) // expected-error {{'S1' does not refer to a value}}
357 for (int i = 0; i < 10; ++i)
358 foo();
359 #pragma omp target
360 #pragma omp teams
361 #pragma omp distribute parallel for simd reduction(+ : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{const-qualified variable cannot be reduction}} expected-error {{'operator+' is a private member of 'S2'}} expected-error {{incomplete type 'S1' where a complete type is required}}
362 for (int i = 0; i < 10; ++i)
363 foo();
364 #pragma omp target
365 #pragma omp teams
366 #pragma omp distribute parallel for simd reduction(min : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 2 {{const-qualified variable cannot be reduction}} expected-error {{incomplete type 'S1' where a complete type is required}}
367 for (int i = 0; i < 10; ++i)
368 foo();
369 #pragma omp target
370 #pragma omp teams
371 #pragma omp distribute parallel for simd reduction(max : h.b) // expected-error {{expected variable name, array element or array section}}
372 for (int i = 0; i < 10; ++i)
373 foo();
374 #pragma omp target
375 #pragma omp teams
376 #pragma omp distribute parallel for simd reduction(+ : ba) // expected-error {{const-qualified variable cannot be reduction}}
377 for (int i = 0; i < 10; ++i)
378 foo();
379 #pragma omp target
380 #pragma omp teams
381 #pragma omp distribute parallel for simd reduction(* : ca) // expected-error {{const-qualified variable cannot be reduction}}
382 for (int i = 0; i < 10; ++i)
383 foo();
384 #pragma omp target
385 #pragma omp teams
386 #pragma omp distribute parallel for simd reduction(- : da) // expected-error {{const-qualified variable cannot be reduction}}
387 for (int i = 0; i < 10; ++i)
388 foo();
389 #pragma omp target
390 #pragma omp teams
391 #pragma omp distribute parallel for simd reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
392 for (int i = 0; i < 10; ++i)
393 foo();
394 #pragma omp target
395 #pragma omp teams
396 #pragma omp distribute parallel for simd reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
397 for (int i = 0; i < 10; ++i)
398 foo();
399 #pragma omp target
400 #pragma omp teams
401 #pragma omp distribute parallel for simd reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
402 for (int i = 0; i < 10; ++i)
403 foo();
404 #pragma omp target
405 #pragma omp teams
406 #pragma omp distribute parallel for simd reduction(& : e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} expected-error {{invalid operands to binary expression ('S5' and 'S5')}}
407 for (int i = 0; i < 10; ++i)
408 foo();
409 #pragma omp target
410 #pragma omp teams
411 #pragma omp distribute parallel for simd reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}}
412 for (int i = 0; i < 10; ++i)
413 foo();
414 #pragma omp target
415 #pragma omp teams
416 #pragma omp distribute parallel for simd reduction(+ : z, o) // expected-error {{no viable overloaded '='}}
417 for (int i = 0; i < 10; ++i)
418 foo();
419 #pragma omp target
420 #pragma omp teams
421 #pragma omp distribute parallel for simd private(i), reduction(+ : j), reduction(+ : q) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
422 for (int i = 0; i < 10; ++i)
423 foo();
424 #pragma omp parallel private(k)
425 #pragma omp target
426 #pragma omp teams
427 #pragma omp distribute parallel for simd reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
428 for (int i = 0; i < 10; ++i)
429 foo();
430 #pragma omp target
431 #pragma omp teams
432 #pragma omp distribute parallel for simd reduction(+ : p), reduction(+ : p) // expected-error {{variable can appear only once in OpenMP 'reduction' clause}} expected-note {{previously referenced here}}
433 for (int i = 0; i < 10; ++i)
434 foo();
435 #pragma omp target
436 #pragma omp teams
437 #pragma omp distribute parallel for simd reduction(+ : r) // expected-error {{const-qualified variable cannot be reduction}}
438 for (int i = 0; i < 10; ++i)
439 foo();
440 #pragma omp parallel shared(i)
441 #pragma omp parallel reduction(min : i)
442 #pragma omp target
443 #pragma omp teams
444 #pragma omp distribute parallel for simd reduction(max : j) // expected-error {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
445 for (int i = 0; i < 10; ++i)
446 foo();
447 #pragma omp parallel private(fl)
448 #pragma omp target
449 #pragma omp teams
450 #pragma omp distribute parallel for simd reduction(+ : fl)
451 for (int i = 0; i < 10; ++i)
452 foo();
453 #pragma omp parallel reduction(* : fl)
454 #pragma omp target
455 #pragma omp teams
456 #pragma omp distribute parallel for simd reduction(+ : fl)
457 for (int i = 0; i < 10; ++i)
458 foo();
459 static int m;
460 #pragma omp target
461 #pragma omp teams
462 #pragma omp distribute parallel for simd reduction(+ : m) // OK
463 for (int i = 0; i < 10; ++i)
464 m++;
465 #pragma omp target
466 #pragma omp teams
467 #pragma omp distribute parallel for simd reduction(task, + : m) // omp45-error 2 {{expected expression}} omp45-warning {{missing ':' after reduction identifier - ignoring}} omp50-error {{'reduction' clause with 'task' modifier allowed only on non-simd parallel or worksharing constructs}}
468 for (int i = 0; i < 10; ++i)
469 m++;
470
471 return tmain(argc) + tmain(fl); // expected-note {{in instantiation of function template specialization 'tmain<int>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<float>' requested here}}
472 }
473