Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / gcc.dg / gomp / udr-3.c
blob96450cd50e2ee58466a82409ff342e3828bd24d6
1 /* { dg-do compile } */
2 /* { dg-options "-fopenmp -std=gnu89" } */
4 struct S { int s; };
5 struct T { int t; };
6 struct U { int u; };
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)
13 void
14 f1 ()
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;
25 void bar (struct S *);
27 void
28 f2 ()
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" } */
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" } */
37 void
38 f3 ()
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" } */
44 struct V
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" } */
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)
55 void
56 f4 (void)
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)
64 void
65 f5 (void)
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" } */
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;