1 // RUN: %libomp-compile-and-run
3 #include "omp_testsuite.h"
4 /* The bug occurs if the lock table is reallocated after
5 kmp_set_defaults() is called. If the table is reallocated,
6 then the lock will not point to a valid lock object after the
7 kmp_set_defaults() call.*/
10 int test_kmp_set_defaults_lock_bug()
12 /* checks that omp_get_num_threads is equal to the number of
23 omp_unset_lock(&lock
);
26 nthreads_lib
= omp_get_num_threads ();
28 } /* end of parallel */
29 kmp_set_defaults("OMP_NUM_THREADS");
34 omp_unset_lock(&lock
);
35 } /* end of parallel */
37 return (nthreads
== 2*nthreads_lib
);
46 for(i
= 0; i
< REPETITIONS
; i
++) {
47 if(!test_kmp_set_defaults_lock_bug()) {
51 omp_destroy_lock(&lock
);