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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130600
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
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...
--- /dev/null
+! { 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" } }