Skip gnat.dg/prot7.adb on hppa.
[official-gcc.git] / libgomp / testsuite / libgomp.c-c++-common / task-reduction-15.c
blob5e87139ccfb1b71d563cf6670c57408061be95af
1 /* PR middle-end/101167 */
3 extern
4 #ifdef __cplusplus
5 "C"
6 #endif
7 void abort (void);
9 struct S { int a, b, c[2]; };
11 void
12 init (struct S *x)
14 x->a = 0;
15 x->b = 0;
16 x->c[0] = 0;
17 x->c[1] = 0;
20 void
21 merge (struct S *x, struct S *y)
23 x->a += y->a;
24 x->b += y->b;
27 #pragma omp declare reduction (+: struct S : merge (&omp_out, &omp_in)) initializer (init (&omp_priv))
29 void
30 foo (struct S x)
32 #pragma omp taskgroup task_reduction (+: x)
34 #pragma omp task in_reduction (+: x)
36 x.a++;
37 x.b++;
39 #pragma omp task in_reduction (+: x)
41 x.a += 4;
42 x.b += 14;
44 #pragma omp task in_reduction (+: x)
46 x.a += 9;
47 x.b += 19;
50 if (x.a != 56 || x.b != 86)
51 abort ();
54 int
55 main ()
57 struct S x = { 42, 52 };
58 #pragma omp parallel master num_threads(3)
59 foo (x);
60 return 0;