Fix type compatibility for types with flexible array member 2/2 [PR113688,PR114713...
[gcc.git] / libgomp / testsuite / libgomp.c / task-reduction-3.c
blobf912bd9569b744e62c2f3a50f64fa575a68ad332
1 extern void abort (void);
3 int
4 foo (void)
6 int i = -1, j = -1, k;
7 void nested (void) { i++; j++; }
8 nested ();
9 #pragma omp taskgroup task_reduction (+: i)
11 #pragma omp task in_reduction (+: i)
12 i++;
13 #pragma omp task in_reduction (+: i)
14 i += 6;
16 #pragma omp taskloop reduction (+: j)
17 for (k = 0; k < 2; k++)
19 j += 5;
20 #pragma omp task in_reduction (+: j)
21 j += 31;
23 return i + j;
26 int
27 bar (void)
29 int i = 0, j = 0;
30 void nested (void)
32 int k;
33 #pragma omp taskgroup task_reduction (+: i)
35 #pragma omp task in_reduction (+: i)
36 i++;
37 #pragma omp task in_reduction (+: i)
38 i += 7;
40 #pragma omp taskloop reduction (+: j)
41 for (k = 0; k < 2; k++)
43 j += 21;
44 #pragma omp task in_reduction (+: j)
45 j += 8;
48 nested ();
49 return i + j;
52 int
53 main ()
55 if (foo () != (1 + 6 + (5 + 31) * 2))
56 abort ();
57 if (bar () != (1 + 7 + (21 + 8) * 2))
58 abort ();
59 return 0;