1 // RUN: %libomp-compile-and-run
4 #include "omp_testsuite.h"
6 /* Utility function do spend some time in a loop */
7 int test_omp_task_private()
12 int result
= 0; /* counts the wrong sums from tasks */
14 known_sum
= (LOOPCOUNT
* (LOOPCOUNT
+ 1)) / 2;
20 for (i
= 0; i
< NUM_TASKS
; i
++) {
21 #pragma omp task private(sum) shared(result, known_sum)
24 //if sum is private, initialize to 0
26 for (j
= 0; j
<= LOOPCOUNT
; j
++) {
30 /* check if calculated sum was right */
31 if (sum
!= known_sum
) {
35 } /* end of omp task */
38 } /* end of parallel*/
47 for(i
= 0; i
< REPETITIONS
; i
++) {
48 if(!test_omp_task_private()) {