1 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -ferror-limit 150 -o - %s -Wuninitialized
2 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
3 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
4 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -ferror-limit 150 -o - %s -Wuninitialized
5 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
6 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
7
8 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -ferror-limit 150 -o - %s -Wuninitialized
9 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
10 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized
11 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -ferror-limit 150 -o - %s -Wuninitialized
12 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s -Wuninitialized
13 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s -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 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 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;
105 long z;
106 T &j = i; // expected-note 4 {{'j' defined here}}
107 S3 &p = k; // expected-note 2 {{'p' defined here}}
108 const T &r = da[(int)i]; // expected-note 2 {{'r' defined here}}
109 T &q = qa[(int)i]; // expected-note 2 {{'q' defined here}}
110 T fl;
111 #pragma omp target
112 #pragma omp teams
113 #pragma omp distribute simd reduction // expected-error {{expected '(' after 'reduction'}}
114 for (int i = 0; i < 10; ++i)
115 foo();
116 #pragma omp target
117 #pragma omp teams
118 #pragma omp distribute simd reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp distribute simd' are ignored}}
119 for (int i = 0; i < 10; ++i)
120 foo();
121 #pragma omp target
122 #pragma omp teams
123 #pragma omp distribute simd reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
124 for (int i = 0; i < 10; ++i)
125 foo();
126 #pragma omp target
127 #pragma omp teams
128 #pragma omp distribute simd reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
129 for (int i = 0; i < 10; ++i)
130 foo();
131 #pragma omp target
132 #pragma omp teams
133 #pragma omp distribute simd reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
134 for (int i = 0; i < 10; ++i)
135 foo();
136 #pragma omp target
137 #pragma omp teams
138 #pragma omp distribute simd reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}}
139 for (int i = 0; i < 10; ++i)
140 foo();
141 #pragma omp target
142 #pragma omp teams
143 #pragma omp distribute simd reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
144 for (int i = 0; i < 10; ++i)
145 foo();
146 #pragma omp target
147 #pragma omp teams
148 #pragma omp distribute simd reduction(& : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{invalid operands to binary expression ('float' and 'float')}}
149 for (int i = 0; i < 10; ++i)
150 foo();
151 #pragma omp target
152 #pragma omp teams
153 #pragma omp distribute 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')}}
154 for (int i = 0; i < 10; ++i)
155 foo();
156 #pragma omp target
157 #pragma omp teams
158 #pragma omp distribute simd reduction(|| : argc ? i : argc) // expected-error 2 {{expected variable name, array element or array section}}
159 for (int i = 0; i < 10; ++i)
160 foo();
161 #pragma omp target
162 #pragma omp teams
163 #pragma omp distribute 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'}}
164 for (int i = 0; i < 10; ++i)
165 foo();
166 #pragma omp target
167 #pragma omp teams
168 #pragma omp distribute 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 '('}}
169 for (int i = 0; i < 10; ++i)
170 foo();
171 #pragma omp target
172 #pragma omp teams
173 #pragma omp distribute simd reduction(^ : z, T) // expected-error {{'T' does not refer to a value}}
174 for (int i = 0; i < 10; ++i)
175 foo();
176 #pragma omp target
177 #pragma omp teams
178 #pragma omp distribute 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'}} expected-warning 2 {{Type 'S2' is not trivially copyable and not guaranteed to be mapped correctly}} expected-warning 2 {{Type 'S3' is not trivially copyable and not guaranteed to be mapped correctly}}
179 for (int i = 0; i < 10; ++i)
180 foo();
181 #pragma omp target
182 #pragma omp teams
183 #pragma omp distribute 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}}
184 for (int i = 0; i < 10; ++i)
185 foo();
186 #pragma omp target
187 #pragma omp teams
188 #pragma omp distribute simd reduction(max : h.b) // expected-error {{expected variable name, array element or array section}}
189 for (int i = 0; i < 10; ++i)
190 foo();
191 #pragma omp target
192 #pragma omp teams
193 #pragma omp distribute simd reduction(+ : ba) // expected-error {{const-qualified variable cannot be reduction}}
194 for (int i = 0; i < 10; ++i)
195 foo();
196 #pragma omp target
197 #pragma omp teams
198 #pragma omp distribute simd reduction(* : ca) // expected-error {{const-qualified variable cannot be reduction}}
199 for (int i = 0; i < 10; ++i)
200 foo();
201 #pragma omp target
202 #pragma omp teams
203 #pragma omp distribute simd reduction(- : da) // expected-error {{const-qualified variable cannot be reduction}} expected-error {{const-qualified variable cannot be reduction}}
204 for (int i = 0; i < 10; ++i)
205 foo();
206 #pragma omp target
207 #pragma omp teams
208 #pragma omp distribute simd reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
209 for (int i = 0; i < 10; ++i)
210 foo();
211 #pragma omp target
212 #pragma omp teams
213 #pragma omp distribute simd reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
214 for (int i = 0; i < 10; ++i)
215 foo();
216 #pragma omp target
217 #pragma omp teams
218 #pragma omp distribute simd reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
219 for (int i = 0; i < 10; ++i)
220 foo();
221 #pragma omp target
222 #pragma omp teams
223 #pragma omp distribute simd reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}} expected-warning 2 {{Type 'S3' is not trivially copyable and not guaranteed to be mapped correctly}}
224 for (int i = 0; i < 10; ++i)
225 foo();
226 #pragma omp target
227 #pragma omp teams
228 #pragma omp distribute simd reduction(+ : o) // expected-error 2 {{no viable overloaded '='}}
229 for (int i = 0; i < 10; ++i)
230 foo();
231 #pragma omp target
232 #pragma omp teams
233 #pragma omp distribute simd private(i), reduction(+ : j), reduction(+ : q) // expected-error 4 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
234 for (int i = 0; i < 10; ++i)
235 foo();
236 #pragma omp parallel private(k)
237 #pragma omp target
238 #pragma omp teams
239 #pragma omp distribute simd reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
240 for (int i = 0; i < 10; ++i)
241 foo();
242 #pragma omp target
243 #pragma omp teams
244 #pragma omp distribute simd reduction(+ : p), reduction(+ : p) // expected-error 2 {{variable can appear only once in OpenMP 'reduction' clause}} expected-note 2 {{previously referenced here}}
245 for (int i = 0; i < 10; ++i)
246 foo();
247 #pragma omp target
248 #pragma omp teams
249 #pragma omp distribute simd reduction(+ : r) // expected-error 2 {{const-qualified variable cannot be reduction}}
250 for (int i = 0; i < 10; ++i)
251 foo();
252 #pragma omp parallel shared(i)
253 #pragma omp parallel reduction(min : i)
254 #pragma omp target
255 #pragma omp teams
256 #pragma omp distribute simd reduction(max : j) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
257 for (int i = 0; i < 10; ++i)
258 foo();
259 #pragma omp parallel private(fl)
260 #pragma omp target
261 #pragma omp teams
262 #pragma omp distribute simd reduction(+ : fl)
263 for (int i = 0; i < 10; ++i)
264 foo();
265 #pragma omp parallel reduction(* : fl)
266 #pragma omp target
267 #pragma omp teams
268 #pragma omp distribute simd reduction(+ : fl)
269 for (int i = 0; i < 10; ++i)
270 foo();
271 #pragma omp target
272 #pragma omp teams
273 #pragma omp distribute simd reduction(task, + : fl) // omp45-error 2 {{expected expression}} omp45-warning {{missing ':' after reduction identifier - ignoring}} omp50-error 3 {{'reduction' clause with 'task' modifier allowed only on non-simd parallel or worksharing constructs}}
274 for (int i = 0; i < 10; ++i)
275 foo();
276
277 return T();
278 }
279
280 namespace A {
281 double x;
282 #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
283 }
284 namespace B {
285 using A::x;
286 }
287
main(int argc,char ** argv)288 int main(int argc, char **argv) {
289 const int d = 5; // expected-note 2 {{'d' defined here}}
290 const int da[5] = {0}; // expected-note {{'da' defined here}}
291 int qa[5] = {0};
292 S4 e(4);
293 S5 g(5);
294 int i, z;
295 int &j = i; // expected-note 2 {{'j' defined here}}
296 S3 &p = k; // expected-note 2 {{'p' defined here}}
297 const int &r = da[i]; // expected-note {{'r' defined here}}
298 int &q = qa[i]; // expected-note {{'q' defined here}}
299 float fl;
300 #pragma omp target
301 #pragma omp teams
302 #pragma omp distribute simd reduction // expected-error {{expected '(' after 'reduction'}}
303 for (int i = 0; i < 10; ++i)
304 foo();
305 #pragma omp target
306 #pragma omp teams
307 #pragma omp distribute simd reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp distribute simd' are ignored}}
308 for (int i = 0; i < 10; ++i)
309 foo();
310 #pragma omp target
311 #pragma omp teams
312 #pragma omp distribute simd reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
313 for (int i = 0; i < 10; ++i)
314 foo();
315 #pragma omp target
316 #pragma omp teams
317 #pragma omp distribute simd reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
318 for (int i = 0; i < 10; ++i)
319 foo();
320 #pragma omp target
321 #pragma omp teams
322 #pragma omp distribute simd reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
323 for (int i = 0; i < 10; ++i)
324 foo();
325 #pragma omp target
326 #pragma omp teams
327 #pragma omp distribute simd reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}}
328 for (int i = 0; i < 10; ++i)
329 foo();
330 #pragma omp target
331 #pragma omp teams
332 #pragma omp distribute simd reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
333 for (int i = 0; i < 10; ++i)
334 foo();
335 #pragma omp target
336 #pragma omp teams
337 #pragma omp distribute simd reduction(foo : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max'}}
338 for (int i = 0; i < 10; ++i)
339 foo();
340 #pragma omp target
341 #pragma omp teams
342 #pragma omp distribute simd reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
343 for (int i = 0; i < 10; ++i)
344 foo();
345 #pragma omp target
346 #pragma omp teams
347 #pragma omp distribute simd reduction(|| : argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name, array element or array section}}
348 for (int i = 0; i < 10; ++i)
349 foo();
350 #pragma omp target
351 #pragma omp teams
352 #pragma omp distribute simd reduction(~ : argc) // expected-error {{expected unqualified-id}}
353 for (int i = 0; i < 10; ++i)
354 foo();
355 #pragma omp target
356 #pragma omp teams
357 #pragma omp distribute simd reduction(&& : z, argc)
358 for (int i = 0; i < 10; ++i)
359 foo();
360 #pragma omp target
361 #pragma omp teams
362 #pragma omp distribute simd reduction(^ : S1) // expected-error {{'S1' does not refer to a value}}
363 for (int i = 0; i < 10; ++i)
364 foo();
365 #pragma omp target
366 #pragma omp teams
367 #pragma omp distribute 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-warning {{Type 'S2' is not trivially copyable and not guaranteed to be mapped correctly}} expected-warning {{Type 'S3' is not trivially copyable and not guaranteed to be mapped correctly}} expected-error {{incomplete type 'S1' where a complete type is required}}
368 for (int i = 0; i < 10; ++i)
369 foo();
370 #pragma omp target
371 #pragma omp teams
372 #pragma omp distribute 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-warning {{Type 'S2' is not trivially copyable and not guaranteed to be mapped correctly}} expected-warning {{Type 'S3' is not trivially copyable and not guaranteed to be mapped correctly}} expected-error {{incomplete type 'S1' where a complete type is required}}
373 for (int i = 0; i < 10; ++i)
374 foo();
375 #pragma omp target
376 #pragma omp teams
377 #pragma omp distribute simd reduction(max : h.b) // expected-error {{expected variable name, array element or array section}}
378 for (int i = 0; i < 10; ++i)
379 foo();
380 #pragma omp target
381 #pragma omp teams
382 #pragma omp distribute simd reduction(+ : ba) // expected-error {{const-qualified variable cannot be reduction}} expected-warning {{Type 'const S2 [5]' is not trivially copyable and not guaranteed to be mapped correctly}}
383 for (int i = 0; i < 10; ++i)
384 foo();
385 #pragma omp target
386 #pragma omp teams
387 #pragma omp distribute simd reduction(* : ca) // expected-error {{const-qualified variable cannot be reduction}} expected-warning {{Type 'const S3 [5]' is not trivially copyable and not guaranteed to be mapped correctly}}
388 for (int i = 0; i < 10; ++i)
389 foo();
390 #pragma omp target
391 #pragma omp teams
392 #pragma omp distribute simd reduction(- : da) // expected-error {{const-qualified variable cannot be reduction}}
393 for (int i = 0; i < 10; ++i)
394 foo();
395 #pragma omp target
396 #pragma omp teams
397 #pragma omp distribute simd reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
398 for (int i = 0; i < 10; ++i)
399 foo();
400 #pragma omp target
401 #pragma omp teams
402 #pragma omp distribute simd reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
403 for (int i = 0; i < 10; ++i)
404 foo();
405 #pragma omp target
406 #pragma omp teams
407 #pragma omp distribute simd reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
408 for (int i = 0; i < 10; ++i)
409 foo();
410 #pragma omp target
411 #pragma omp teams
412 #pragma omp distribute 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')}} expected-warning {{Type 'S4' is not trivially copyable and not guaranteed to be mapped correctly}} expected-warning {{Type 'S5' is not trivially copyable and not guaranteed to be mapped correctly}}}
413 for (int i = 0; i < 10; ++i)
414 foo();
415 #pragma omp target
416 #pragma omp teams
417 #pragma omp distribute simd reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}} expected-warning {{Type 'S3' is not trivially copyable and not guaranteed to be mapped correctly}}
418 for (int i = 0; i < 10; ++i)
419 foo();
420 #pragma omp target
421 #pragma omp teams
422 #pragma omp distribute simd reduction(+ : o) // expected-error {{no viable overloaded '='}}
423 for (int i = 0; i < 10; ++i)
424 foo();
425 #pragma omp target
426 #pragma omp teams
427 #pragma omp distribute simd private(i), reduction(+ : j), reduction(+ : q) // 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 #if __cplusplus < 201103L // < C++11
431 // expected-warning@+5 {{Type 'S3' is not trivially copyable and not guaranteed to be mapped correctly}}
432 #endif
433 #pragma omp parallel private(k)
434 #pragma omp target
435 #pragma omp teams
436 #pragma omp distribute simd reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
437 for (int i = 0; i < 10; ++i)
438 foo();
439 #if __cplusplus < 201103L // < C++11
440 // expected-warning@+4 {{Type 'S3' is not trivially copyable and not guaranteed to be mapped correctly}}
441 #endif
442 #pragma omp target
443 #pragma omp teams
444 #pragma omp distribute simd reduction(+ : p), reduction(+ : p) // expected-error {{variable can appear only once in OpenMP 'reduction' clause}} expected-note {{previously referenced here}}
445 for (int i = 0; i < 10; ++i)
446 foo();
447 #pragma omp target
448 #pragma omp teams
449 #pragma omp distribute simd reduction(+ : r) // expected-error {{const-qualified variable cannot be reduction}}
450 for (int i = 0; i < 10; ++i)
451 foo();
452 #pragma omp parallel shared(i)
453 #pragma omp parallel reduction(min : i)
454 #pragma omp target
455 #pragma omp teams
456 #pragma omp distribute simd reduction(max : j) // expected-error {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
457 for (int i = 0; i < 10; ++i)
458 foo();
459 #pragma omp parallel private(fl)
460 #pragma omp target
461 #pragma omp teams
462 #pragma omp distribute simd reduction(+ : fl)
463 for (int i = 0; i < 10; ++i)
464 foo();
465 #pragma omp parallel reduction(* : fl)
466 #pragma omp target
467 #pragma omp teams
468 #pragma omp distribute simd reduction(+ : fl)
469 for (int i = 0; i < 10; ++i)
470 foo();
471 static int m;
472 #pragma omp target
473 #pragma omp teams
474 #pragma omp distribute simd reduction(+ : m) // OK
475 for (int i = 0; i < 10; ++i)
476 m++;
477
478 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}}
479 }
480