1! { dg-do run }
2
3  use omp_lib
4
5  integer (kind = omp_nest_lock_kind) :: lock
6  logical :: l
7
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)
24end
25