Fix gcc.c-torture/execute/ieee/cdivchkf.c on hpux
[official-gcc.git] / libgomp / testsuite / libgomp.fortran / task-detach-2.f90
blob68e3ff2ef816fd9c7a08260305ef5153e5f39c0c
1 ! { dg-do run }
3 ! Test handling of detach clause with only a single thread. The runtime
4 ! should not block when a task with an unfulfilled event finishes
5 ! running.
7 program task_detach_2
8 use omp_lib
10 integer (kind=omp_event_handle_kind) :: detach_event1, detach_event2
11 integer :: x = 0, y = 0, z = 0
13 !$omp parallel num_threads (1)
14 !$omp single
15 !$omp task detach (detach_event1)
16 x = x + 1
17 !$omp end task
19 !$omp task detach (detach_event2)
20 y = y + 1
21 call omp_fulfill_event (detach_event1)
22 !$omp end task
24 !$omp task
25 z = z + 1
26 call omp_fulfill_event (detach_event2)
27 !$omp end task
28 !$omp end single
29 !$omp end parallel
31 if (x /= 1) stop 1
32 if (y /= 1) stop 2
33 if (z /= 1) stop 3
34 end program