[Transforms] Silence a warning in SROA.cpp (NFC)
[llvm-project.git] / openmp / runtime / test / worksharing / sections / omp_section_private.c
blobbf2a30d50878b9f9c17c61fa271b8a381c5de9e1
1 // RUN: %libomp-compile-and-run
2 #include <stdio.h>
3 #include "omp_testsuite.h"
5 int test_omp_section_private()
7 int sum;
8 int sum0;
9 int i;
10 int known_sum;
12 sum = 7;
13 sum0 = 0;
15 #pragma omp parallel
17 #pragma omp sections private(sum0,i)
19 #pragma omp section
21 sum0 = 0;
22 for (i = 1; i < 400; i++)
23 sum0 = sum0 + i;
24 #pragma omp critical
26 sum = sum + sum0;
29 #pragma omp section
31 sum0 = 0;
32 for (i = 400; i < 700; i++)
33 sum0 = sum0 + i;
34 #pragma omp critical
36 sum = sum + sum0;
39 #pragma omp section
41 sum0 = 0;
42 for (i = 700; i < 1000; i++)
43 sum0 = sum0 + i;
44 #pragma omp critical
46 sum = sum + sum0;
49 } /*end of sections*/
50 } /* end of parallel */
51 known_sum = (999 * 1000) / 2 + 7;
52 return (known_sum == sum);
53 } /* end of check_section_private*/
55 int main()
57 int i;
58 int num_failed=0;
60 for(i = 0; i < REPETITIONS; i++) {
61 if(!test_omp_section_private()) {
62 num_failed++;
65 return num_failed;