PR target/84064
[official-gcc.git] / libgomp / testsuite / libgomp.c / lock-2.c
blob9009b12fe5d00be5a662fd5d5cd5b956c6495285
1 #include <omp.h>
2 #include <stdlib.h>
4 int
5 main (void)
7 int l = 0;
8 omp_nest_lock_t lock;
9 omp_init_nest_lock (&lock);
10 #pragma omp parallel reduction (+:l) num_threads (1)
12 if (omp_test_nest_lock (&lock) != 1)
13 l++;
14 if (omp_test_nest_lock (&lock) != 2)
15 l++;
16 #pragma omp task if (0) shared (lock, l)
18 if (omp_test_nest_lock (&lock) != 0)
19 l++;
21 #pragma omp taskwait
22 if (omp_test_nest_lock (&lock) != 3)
23 l++;
24 omp_unset_nest_lock (&lock);
25 omp_unset_nest_lock (&lock);
26 omp_unset_nest_lock (&lock);
28 if (l)
29 abort ();
30 omp_destroy_nest_lock (&lock);
31 return 0;