Commit 3c031ab9 by Tobias Burnus Committed by Tobias Burnus

re PR fortran/34318 (Modules: Infinity/NaN parameters read as 0.0)

2007-12-04  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34318
        * module.c (mio_gmp_real): Properly write NaN and Infinity.

2007-12-04  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34318
        * gfortran.dg/module_nan.f90: New.

From-SVN: r130600
parent 0ffd38c8
2007-12-04 Tobias Burnus <burnus@net-b.de>
PR fortran/34318
* module.c (mio_gmp_real): Properly write NaN and Infinity.
2007-12-02 Tobias Burnus <burnus@net-b.de>
PR fortran/34186
......
......@@ -2535,6 +2535,14 @@ mio_gmp_real (mpfr_t *real)
else
{
p = mpfr_get_str (NULL, &exponent, 16, 0, *real, GFC_RND_MODE);
if (mpfr_nan_p (*real) || mpfr_inf_p (*real))
{
write_atom (ATOM_STRING, p);
gfc_free (p);
return;
}
atom_string = gfc_getmem (strlen (p) + 20);
sprintf (atom_string, "0.%s@%ld", p, exponent);
......
2007-12-04 Tobias Burnus <burnus@net-b.de>
PR fortran/34318
* gfortran.dg/module_nan.f90: New.
2007-12-04 Richard Sandiford <rsandifo@nildram.co.uk>
* lib/target-supports.exp (get_compiler_messages): Replace with...
! { dg-do run }
! { dg-options "-fno-range-check" }
!
! PR fortran/34318
!
! Infinity and NaN were not properly written to the .mod file.
!
module nonordinal
implicit none
real, parameter :: inf = 1./0., nan = 0./0., minf = -1./0.0
end module nonordinal
program a
use nonordinal
implicit none
character(len=20) :: str
if (log(abs(inf)) < huge(inf)) call abort()
if (log(abs(minf)) < huge(inf)) call abort()
if (.not. isnan(nan)) call abort()
write(str,*) inf
if (adjustl(str) /= "+Infinity") call abort()
write(str,*) minf
if (adjustl(str) /= "-Infinity") call abort()
write(str,*) nan
if (adjustl(str) /= "NaN") call abort()
end program a
! { dg-final { cleanup-modules "nonordinal" } }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment