111
|
1 /* { dg-do compile } */
|
|
2 /* { dg-options "-fopenmp -std=gnu89" } */
|
|
3
|
|
4 struct S { int s; };
|
|
5 struct T { int t; };
|
|
6 struct U { int u; };
|
|
7
|
|
8 #pragma omp declare reduction (+: struct S: omp_out.s += omp_in.s)
|
|
9 #pragma omp declare reduction (*: struct S: omp_out.s *= omp_in.s) \
|
|
10 initializer (omp_priv = {1})
|
|
11 #pragma omp declare reduction (foo: struct S: omp_out.s += omp_in.s)
|
|
12
|
|
13 void
|
|
14 f1 ()
|
|
15 {
|
|
16 struct S s, s2;
|
|
17 struct T t;
|
|
18 #pragma omp declare reduction (+: struct T: omp_out.t += omp_in.t)
|
|
19 #pragma omp parallel reduction (+: t) reduction (foo: s) reduction (*: s2)
|
|
20 s.s = 1, t.t = 1, s2.s = 2;
|
|
21 #pragma omp parallel reduction (+: s)
|
|
22 s.s = 1;
|
|
23 }
|
|
24
|
|
25 void bar (struct S *);
|
|
26
|
|
27 void
|
|
28 f2 ()
|
|
29 {
|
|
30 #pragma omp declare reduction (foo: struct S: omp_out.s += omp_in.s) initializer (bar (&omp_priv))
|
|
31 #pragma omp declare reduction (bar: struct S: omp_out.s += omp_in.s) initializer (bar (&omp_orig)) /* { dg-error "one of the initializer call arguments should be" } */
|
|
32 }
|
|
33
|
|
34 #pragma omp declare reduction (+: struct U: omp_out.u *= omp_in.u) /* { dg-error "previous" } */
|
|
35 #pragma omp declare reduction (+: struct U: omp_out.u += omp_in.u) /* { dg-error "redeclaration of" } */
|
|
36
|
|
37 void
|
|
38 f3 ()
|
|
39 {
|
|
40 #pragma omp declare reduction (f3: struct U: omp_out.u *= omp_in.u) /* { dg-error "previous" } */
|
|
41 #pragma omp declare reduction (f3: struct U: omp_out.u += omp_in.u) /* { dg-error "redeclaration of" } */
|
|
42 }
|
|
43
|
|
44 struct V
|
|
45 {
|
|
46 #pragma omp declare reduction (bar: struct S: omp_out.s *= omp_in.s) /* { dg-error "not at file or block scope" } */
|
|
47 #pragma omp declare reduction (bar: struct S: omp_out.s += omp_in.s) /* { dg-error "not at file or block scope" } */
|
|
48 };
|
|
49
|
|
50 #pragma omp declare reduction (n3: long: omp_out += omp_in) /* { dg-error "previous" } */
|
|
51 #pragma omp declare reduction (n3: long int: omp_out += omp_in) /* { dg-error "redeclaration of" } */
|
|
52 #pragma omp declare reduction (n3: short unsigned: omp_out += omp_in)
|
|
53 #pragma omp declare reduction (n3: short int: omp_out += omp_in)
|
|
54
|
|
55 void
|
|
56 f4 (void)
|
|
57 {
|
|
58 #pragma omp declare reduction (f4: long: omp_out += omp_in) /* { dg-error "previous" } */
|
|
59 #pragma omp declare reduction (f4: long int: omp_out += omp_in) /* { dg-error "redeclaration of" } */
|
|
60 #pragma omp declare reduction (f4: short unsigned: omp_out += omp_in)
|
|
61 #pragma omp declare reduction (f4: short int: omp_out += omp_in)
|
|
62 }
|
|
63
|
|
64 void
|
|
65 f5 (void)
|
|
66 {
|
|
67 #pragma omp declare reduction (+: struct S: omp_out.s += omp_in.s) initializer (omp_priv) /* { dg-error "expected" } */
|
|
68 #pragma omp declare reduction (+: struct T: omp_out.t += omp_in.t) initializer (omp_priv ()) /* { dg-error "expected" } */
|
|
69 }
|
|
70
|
|
71 void
|
|
72 f6 (a, b)
|
|
73 #pragma omp declare reduction (bar: struct S: omp_out.s *= omp_in.s) /* { dg-error "expected declaration specifiers before" } */
|
|
74 int a;
|
|
75 int b;
|
|
76 {
|
|
77 }
|