| 1 |
! { dg-do run } |
| 2 |
! { dg-add-options ieee } |
| 3 |
|
| 4 |
! PR43298 Fortran library does not read in NaN, NaN(), -Inf, or Inf |
| 5 |
|
| 6 |
! Formatted READ part of PR fortran/43298 |
| 7 |
|
| 8 |
! Test case prepared by Jerry DeLisle <[email protected]> |
| 9 |
program pr43298 |
| 10 |
real(4) :: x4(7) |
| 11 |
real(8) :: x8(7) |
| 12 |
character(80) :: output |
| 13 |
|
| 14 |
open(10, status='scratch') |
| 15 |
! 0123456789012345678901234567890123456789012345678901234567890123456789 |
| 16 |
write(10,'(a)') "inf nan infinity NaN(dx) -INf NAN InFiNiTy" |
| 17 |
rewind(10) |
| 18 |
x4 = 0.0_4 |
| 19 |
x8 = 0.0_8 |
| 20 |
read(10,'(7f10.3)') x4 |
| 21 |
rewind(10) |
| 22 |
read(10,'(7f10.3)') x8 |
| 23 |
write (output, '("x4 =",7G6.0)') x4 |
| 24 |
if (output.ne."x4 = Inf NaN Inf NaN -Inf NaN Inf") STOP 1 |
| 25 |
write (output, '("x8 =",7G6.0)') x8 |
| 26 |
if (output.ne."x8 = Inf NaN Inf NaN -Inf NaN Inf") STOP 2 |
| 27 |
!print '("x4 =",7G6.0)', x4 |
| 28 |
!print '("x8 =",7G6.0)', x8 |
| 29 |
end program pr43298 |
| 30 |
|