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  if (omp_test_nest_lock (lock) .ne. 1) call abort
11  if (omp_test_nest_lock (lock) .ne. 2) call abort
12!$omp parallel if (.false.) reduction (.or.:l)
13  ! In OpenMP 2.5 this was supposed to return 3,
14  ! but in OpenMP 3.0 the parallel region has a different
15  ! task and omp_*_lock_t are owned by tasks, not by threads.
16  if (omp_test_nest_lock (lock) .ne. 0) l = .true.
17!$omp end parallel
18  if (l) call abort
19  if (omp_test_nest_lock (lock) .ne. 3) call abort
20  call omp_unset_nest_lock (lock)
21  call omp_unset_nest_lock (lock)
22  call omp_unset_nest_lock (lock)
23  call omp_destroy_nest_lock (lock)
24end
25