xfail scan-tree-dump-not throw in g++.dg/pr99966.C on hppa*64*-*-*
[official-gcc.git] / libgomp / testsuite / libgomp.c-c++-common / task-reduction-5.c
blob018dc4fb28e4b3e45e9ecc7f766a91515cdb898f
1 typedef __SIZE_TYPE__ size_t;
2 extern
3 #ifdef __cplusplus
4 "C"
5 #endif
6 void abort (void);
8 int *q;
10 void
11 bar (int *p, int *r, int *t, int s, size_t u)
13 #pragma omp task in_reduction (*: p[0], q[0], r[s - 1], t[0:u + 1])
15 *p *= 4;
16 *q *= 5;
17 r[s - 1] *= 6;
18 t[0] *= 8;
19 t[1] *= 9;
23 void
24 foo (int *p, int *r, int *t, int s, size_t u)
26 int *p2 = p;
27 #pragma omp taskgroup task_reduction (*: p[0], q[0], r[s], t[0:u + 1])
29 p = (int *) 0;
30 s++;
31 bar (p2, r, t, s, u);
32 r++;
33 #pragma omp taskwait
34 #pragma omp task in_reduction (*: p2[0], q[0], r[s - 2], t[0:u + 1])
36 *p2 *= 2;
37 *q *= 3;
38 r[s - 2] *= 7;
39 t[0] *= 10;
40 t[1] *= 11;
42 u = (~(size_t) 0) / 4;
43 s++;
44 p2 = (int *) 0;
45 q = (int *) 0;
46 r = (int *) 0;
47 t = (int *) 0;
51 int
52 main ()
54 int a = 1, b = 1, c[2] = { 1, 0 }, d[3] = { 1, 1, -1 };
55 volatile int zero;
56 zero = 0;
57 q = &b;
58 #pragma omp parallel num_threads (2)
59 #pragma omp master
60 foo (&a, &c[0], &d[0], zero, zero + 1);
61 if (a != 8 || b != 15 || c[0] != 42 || c[1] != 0
62 || d[0] != 80 || d[1] != 99 || d[2] != -1)
63 abort ();
64 return 0;