[memprof] Upgrade a unit test to MemProf Version 3 (#117063)
[llvm-project.git] / openmp / runtime / test / worksharing / sections / omp_parallel_sections_private.c
blob7dab295cff6133444c6fb685daea2db5bd1f2051
1 // RUN: %libomp-compile-and-run
2 #include <stdio.h>
3 #include "omp_testsuite.h"
5 int test_omp_parallel_sections_private()
7 int sum;
8 int sum0;
9 int i;
10 int known_sum;
12 sum = 7;
13 sum0=0;
15 #pragma omp parallel sections private(sum0, i)
17 #pragma omp section
19 sum0=0;
20 for (i=1;i<400;i++)
21 sum0=sum0+i;
22 #pragma omp critical
24 sum= sum+sum0;
27 #pragma omp section
29 sum0=0;
30 for(i=400;i<700;i++)
31 sum0=sum0+i;
32 #pragma omp critical
34 sum= sum+sum0;
37 #pragma omp section
39 sum0=0;
40 for(i=700;i<1000;i++)
41 sum0=sum0+i;
42 #pragma omp critical
44 sum= sum+sum0;
49 known_sum=(999*1000)/2+7;
50 return (known_sum==sum);
51 } /* end of check_section_private*/
53 int main()
55 int i;
56 int num_failed=0;
58 for(i = 0; i < REPETITIONS; i++) {
59 if(!test_omp_parallel_sections_private()) {
60 num_failed++;
63 return num_failed;