| 1 |
! { dg-do run } |
| 2 |
|
| 3 |
function f1 () |
| 4 |
real :: f1 |
| 5 |
f1 = 6.5 |
| 6 |
call sub1 |
| 7 |
contains |
| 8 |
subroutine sub1 |
| 9 |
use omp_lib |
| 10 |
logical :: l |
| 11 |
l = .false. |
| 12 |
!$omp parallel firstprivate (f1) num_threads (2) reduction (.or.:l) |
| 13 |
l = f1 .ne. 6.5 |
| 14 |
if (omp_get_thread_num () .eq. 0) f1 = 8.5 |
| 15 |
if (omp_get_thread_num () .eq. 1) f1 = 14.5 |
| 16 |
!$omp barrier |
| 17 |
l = l .or. (omp_get_thread_num () .eq. 0 .and. f1 .ne. 8.5) |
| 18 |
l = l .or. (omp_get_thread_num () .eq. 1 .and. f1 .ne. 14.5) |
| 19 |
!$omp end parallel |
| 20 |
if (l) stop 1 |
| 21 |
f1 = -2.5 |
| 22 |
end subroutine sub1 |
| 23 |
end function f1 |
| 24 |
|
| 25 |
real :: f1 |
| 26 |
if (f1 () .ne. -2.5) stop 2 |
| 27 |
end |