| 1 |
! { dg-do run } |
| 2 |
! { dg-options "-finit-real=NAN" } |
| 3 |
! { dg-add-options ieee } |
| 4 |
! |
| 5 |
! PR fortran/50619 |
| 6 |
! |
| 7 |
! Contributed by Fred Krogh |
| 8 |
! |
| 9 |
! The NaN initialization used to set the associate name to NaN! |
| 10 |
! |
| 11 |
|
| 12 |
module testa2 |
| 13 |
type, public :: test_ty |
| 14 |
real :: rmult = 1.0e0 |
| 15 |
end type test_ty |
| 16 |
|
| 17 |
contains |
| 18 |
subroutine test(e, var1) |
| 19 |
type(test_ty) :: e |
| 20 |
real :: var1, var2 ! Should get NaN initialized |
| 21 |
|
| 22 |
! Should be the default value |
| 23 |
if (e%rmult /= 1.0) STOP 1 |
| 24 |
|
| 25 |
! Check that NaN initialization is really turned on |
| 26 |
if (var1 == var1) STOP 2 |
| 27 |
if (var2 == var2) STOP 3 |
| 28 |
|
| 29 |
! The following was failing: |
| 30 |
associate (rmult=>e%rmult) |
| 31 |
if (e%rmult /= 1.0) STOP 4 |
| 32 |
end associate |
| 33 |
end subroutine test |
| 34 |
end module testa2 |
| 35 |
|
| 36 |
program testa1 |
| 37 |
use testa2 |
| 38 |
type(test_ty) :: e |
| 39 |
real :: var1 ! Should get NaN initialized |
| 40 |
call test(e, var1) |
| 41 |
stop |
| 42 |
end program testa1 |