1 // RUN: %libomp-compile-and-run 2 #include <stdio.h> 3 #include "omp_testsuite.h" 4 test_omp_parallel_if()5int test_omp_parallel_if() 6 { 7 int i; 8 int sum; 9 int known_sum; 10 int mysum; 11 int control=1; 12 13 sum =0; 14 known_sum = (LOOPCOUNT * (LOOPCOUNT + 1)) / 2 ; 15 #pragma omp parallel private(i) if(control==0) 16 { 17 mysum = 0; 18 for (i = 1; i <= LOOPCOUNT; i++) { 19 mysum = mysum + i; 20 } 21 #pragma omp critical 22 { 23 sum = sum + mysum; 24 } 25 } 26 return (known_sum == sum); 27 } 28 main()29int main() 30 { 31 int i; 32 int num_failed=0; 33 34 for(i = 0; i < REPETITIONS; i++) { 35 if(!test_omp_parallel_if()) { 36 num_failed++; 37 } 38 } 39 return num_failed; 40 } 41