diff options
author | Tobias Burnus <burnus@net-b.de> | 2007-12-04 11:32:04 +0100 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2007-12-04 11:32:04 +0100 |
commit | 3c031ab9dfe19a2158c020ec810e5690d2b3ab90 (patch) | |
tree | 5f2358bbfaf10b9c3d13b1e85b67b9c5db0f5d2c /gcc/fortran/module.c | |
parent | 0ffd38c81f2beb16d71d95a8cfa1b532d9d602ea (diff) | |
download | gcc-3c031ab9dfe19a2158c020ec810e5690d2b3ab90.zip gcc-3c031ab9dfe19a2158c020ec810e5690d2b3ab90.tar.gz gcc-3c031ab9dfe19a2158c020ec810e5690d2b3ab90.tar.bz2 |
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
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r-- | gcc/fortran/module.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index a81067c..af81c3a 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -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); |