1 #ifdef __cplusplus
2 extern "C"
3 #endif
4 void abort (void);
5
6 int a;
7 long int b = 1;
8
9 void
10 foo (void)
11 {
12 int i;
13 for (i = 0; i < 2; i++)
14 #pragma omp task in_reduction (+: a) in_reduction (*: b)
15 {
16 a += 7;
17 b *= 2;
18 }
19 }
20
21 int
22 main ()
23 {
24 int c = 0;
25 #pragma omp parallel
26 #pragma omp single
27 {
28 long int d = 1;
29 #pragma omp taskgroup task_reduction (+: a, c) task_reduction (*: b, d)
30 {
31 int i;
32 for (i = 0; i < 4; i++)
33 #pragma omp task in_reduction (+: a, c) in_reduction (*: b, d)
34 {
35 int j;
36 a += 7;
37 b *= 2;
38 for (j = 0; j < 2; j++)
39 #pragma omp task in_reduction (+: a, c) in_reduction (*: b, d)
40 {
41 a += 7;
42 b *= 2;
43 c += 9;
44 d *= 3;
45 foo ();
46 }
47 c += 9;
48 d *= 3;
49 }
50 }
51 #define THREEP4 (3L * 3L * 3L * 3L)
52 if (d != (THREEP4 * THREEP4 * THREEP4))
53 abort ();
54 }
55 if (a != 28 * 7 || b != (1L << 28) || c != 12 * 9)
56 abort ();
57 return 0;
58 }