[memprof] Upgrade a unit test to MemProf Version 3 (#117063)
[llvm-project.git] / openmp / runtime / test / worksharing / sections / omp_parallel_sections_firstprivate.c
blob1780fabbb29dca7900b826d7acc72889b3e04bab
1 // RUN: %libomp-compile-and-run
2 #include <stdio.h>
3 #include "omp_testsuite.h"
5 int test_omp_parallel_sections_firstprivate()
7 int sum;
8 int sum0;
9 int known_sum;
11 sum =7;
12 sum0=11;
14 #pragma omp parallel sections firstprivate(sum0)
16 #pragma omp section
18 #pragma omp critical
20 sum= sum+sum0;
23 #pragma omp section
25 #pragma omp critical
27 sum= sum+sum0;
30 #pragma omp section
32 #pragma omp critical
34 sum= sum+sum0;
39 known_sum=11*3+7;
40 return (known_sum==sum);
41 } /* end of check_section_firstprivate*/
43 int main()
45 int i;
46 int num_failed=0;
48 for(i = 0; i < REPETITIONS; i++) {
49 if(!test_omp_parallel_sections_firstprivate()) {
50 num_failed++;
53 return num_failed;