[Instrumentation] Fix a warning
[llvm-project.git] / openmp / runtime / test / parallel / omp_parallel_if.c
blob2e281178b566e151964e4136b3c4c378090d4146
1 // RUN: %libomp-compile-and-run
2 // RUN: %libomp-irbuilder-compile-and-run
4 // irbuilder is only available with clang
5 // REQUIRES: clang
7 #include <stdio.h>
8 #include "omp_testsuite.h"
10 int test_omp_parallel_if()
12 int i;
13 int sum;
14 int known_sum;
15 int mysum;
16 int control=1;
18 sum =0;
19 known_sum = (LOOPCOUNT * (LOOPCOUNT + 1)) / 2 ;
20 #pragma omp parallel private(i) if(control==0)
22 mysum = 0;
23 for (i = 1; i <= LOOPCOUNT; i++) {
24 mysum = mysum + i;
26 #pragma omp critical
28 sum = sum + mysum;
31 return (known_sum == sum);
34 int main()
36 int i;
37 int num_failed=0;
39 for(i = 0; i < REPETITIONS; i++) {
40 if(!test_omp_parallel_if()) {
41 num_failed++;
44 return num_failed;