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-12.c
blob0ad92735ca74ae23a30c831b9a661a698724817f
1 extern
2 #ifdef __cplusplus
3 "C"
4 #endif
5 void abort (void);
6 int a, b[3] = { 1, 1, 1 };
7 unsigned long int c[2] = { ~0UL, ~0UL };
9 void
10 bar (int i)
12 #pragma omp task in_reduction (*: b[:3]) in_reduction (&: c[1:]) \
13 in_reduction (+: a)
15 a += 4;
16 b[1] *= 4;
17 c[1] &= ~(1UL << (i + 16));
21 void
22 foo (int x)
24 #pragma omp sections reduction (task, +: a) reduction (task, *: b) \
25 reduction (task, &: c[1:1])
28 a++; b[0] *= 2; bar (2); b[2] *= 3; c[1] &= ~(1UL << 2);
30 #pragma omp section
31 { b[0] *= 2; bar (4); b[2] *= 3; c[1] &= ~(1UL << 4); a++; }
32 #pragma omp section
33 { bar (6); b[2] *= 3; c[1] &= ~(1UL << 6); a++; b[0] *= 2; }
34 #pragma omp section
35 { b[2] *= 3; c[1] &= ~(1UL << 8); a++; b[0] *= 2; bar (8); }
36 #pragma omp section
37 { c[1] &= ~(1UL << 10); a++; b[0] *= 2; bar (10); b[2] *= 3; }
38 #pragma omp section
39 { a++; b[0] *= 2; b[2] *= 3; c[1] &= ~(1UL << 12); bar (12); }
40 #pragma omp section
41 if (x)
43 a++; b[0] *= 2; b[2] *= 3; bar (14); c[1] &= ~(1UL << 14);
48 int
49 main ()
51 volatile int one = 1;
52 foo (!one);
53 if (a != 30 || b[0] != 64 || b[1] != (1 << 12) || b[2] != 3 * 3 * 3 * 3 * 3 * 3
54 || c[0] != ~0UL || c[1] != ~0x15541554UL)
55 abort ();
56 a = 0;
57 b[0] = 1;
58 b[1] = 1;
59 b[2] = 1;
60 c[1] = ~0UL;
61 #pragma omp parallel
62 foo (one);
63 if (a != 35 || b[0] != 128 || b[1] != (1 << 14) || b[2] != 3 * 3 * 3 * 3 * 3 * 3 * 3
64 || c[0] != ~0UL || c[1] != ~0x55545554UL)
65 abort ();
66 return 0;