lock-1.f90 742 B

12345678910111213141516171819202122232425
  1. ! { dg-do run }
  2. use omp_lib
  3. integer (kind = omp_nest_lock_kind) :: lock
  4. logical :: l
  5. l = .false.
  6. call omp_init_nest_lock (lock)
  7. if (omp_test_nest_lock (lock) .ne. 1) call abort
  8. if (omp_test_nest_lock (lock) .ne. 2) call abort
  9. !$omp parallel if (.false.) reduction (.or.:l)
  10. ! In OpenMP 2.5 this was supposed to return 3,
  11. ! but in OpenMP 3.0 the parallel region has a different
  12. ! task and omp_*_lock_t are owned by tasks, not by threads.
  13. if (omp_test_nest_lock (lock) .ne. 0) l = .true.
  14. !$omp end parallel
  15. if (l) call abort
  16. if (omp_test_nest_lock (lock) .ne. 3) call abort
  17. call omp_unset_nest_lock (lock)
  18. call omp_unset_nest_lock (lock)
  19. call omp_unset_nest_lock (lock)
  20. call omp_destroy_nest_lock (lock)
  21. end