2018-06-09 Steven G. Kargl <kargl@gcc.gnu.org>
[official-gcc.git] / libgomp / testsuite / libgomp.fortran / lock-2.f90
blob8608027ef54675a2bb03b3e110e1715a9ec0d890
1 ! { dg-do run }
3 use omp_lib
5 integer (kind = omp_nest_lock_kind) :: lock
6 logical :: l
8 l = .false.
9 call omp_init_nest_lock (lock)
10 !$omp parallel num_threads (1) reduction (.or.:l)
11 if (omp_test_nest_lock (lock) .ne. 1) STOP 1
12 if (omp_test_nest_lock (lock) .ne. 2) STOP 2
13 !$omp task if (.false.) shared (lock, l)
14 if (omp_test_nest_lock (lock) .ne. 0) l = .true.
15 !$omp end task
16 !$omp taskwait
17 if (omp_test_nest_lock (lock) .ne. 3) l = .true.
18 call omp_unset_nest_lock (lock)
19 call omp_unset_nest_lock (lock)
20 call omp_unset_nest_lock (lock)
21 !$omp end parallel
22 if (l) STOP 3
23 call omp_destroy_nest_lock (lock)
24 end