opts: fix narrowing warning
[official-gcc.git] / libgomp / testsuite / libgomp.c / reduction-5.c
blobde87d9f6dc89773d358d846f170ccd4864980447
1 /* PR middle-end/36506 */
3 extern void abort (void);
5 int
6 main (void)
8 int sum = 0, prod = 1;
9 #pragma omp parallel
10 #pragma omp sections reduction (+:sum)
12 #pragma omp section
13 sum += 2;
14 #pragma omp section
15 sum += 2;
16 #pragma omp section
17 sum += 2;
19 if (sum != 6)
20 abort ();
21 sum = 0;
22 #pragma omp parallel sections reduction (+:sum)
24 #pragma omp section
25 sum += 2;
26 #pragma omp section
27 sum += 2;
28 #pragma omp section
29 sum += 2;
31 if (sum != 6)
32 abort ();
33 sum = 0;
34 #pragma omp parallel
35 #pragma omp sections reduction (+:sum) reduction (*:prod)
37 #pragma omp section
39 sum += 2;
40 prod *= 2;
42 #pragma omp section
44 sum += 2;
45 prod *= 2;
47 #pragma omp section
49 sum += 2;
50 prod *= 2;
53 if (sum != 6 || prod != 8)
54 abort ();
55 sum = 0;
56 prod = 1;
57 #pragma omp parallel sections reduction (+:sum) reduction (*:prod)
59 #pragma omp section
61 sum += 2;
62 prod *= 2;
64 #pragma omp section
66 sum += 2;
67 prod *= 2;
69 #pragma omp section
71 sum += 2;
72 prod *= 2;
75 if (sum != 6 || prod != 8)
76 abort ();
77 return 0;