1 // RUN: %libomp-compile-and-run
4 #include "omp_testsuite.h"
6 /* Utility function do spend some time in a loop */
7 static void do_some_work()
11 for(i
= 0; i
< 1000; i
++){
12 sum
+= sqrt ((double) i
);
17 #pragma omp threadprivate(sum1)
19 int test_omp_for_private()
25 sum0
= 0; /* setting (global) sum0 = 0 */
29 sum1
= 0; /* setting sum1 in each thread to 0 */
30 { /* begin of orphaned block */
32 #pragma omp for private(sum0) schedule(static,1)
33 for (i
= 1; i
<= LOOPCOUNT
; i
++) {
41 } /* end of orphaned block */
47 } /* end of parallel*/
48 known_sum
= (LOOPCOUNT
* (LOOPCOUNT
+ 1)) / 2;
49 return (known_sum
== sum
);
57 for(i
= 0; i
< REPETITIONS
; i
++) {
58 if(!test_omp_for_private()) {