aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorJanne Blomqvist <jb@gcc.gnu.org>2012-12-26 00:11:16 +0200
committerJanne Blomqvist <jb@gcc.gnu.org>2012-12-26 00:11:16 +0200
commiteb3119f90fb7a12cd7fe7ad83e3622a064d28ace (patch)
treed25ef69d03aac5fc041242a79c04c1cde4b3a5d1 /libgfortran
parente255044e71508a6cd8023614b0ccd178803e9619 (diff)
downloadgcc-eb3119f90fb7a12cd7fe7ad83e3622a064d28ace.zip
gcc-eb3119f90fb7a12cd7fe7ad83e3622a064d28ace.tar.gz
gcc-eb3119f90fb7a12cd7fe7ad83e3622a064d28ace.tar.bz2
PR fortran/55539 Fix regression in -fno-sign-zero.
libgfortran ChangeLog: 2012-12-26 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/55539 * io/write_float.def (output_float): Take into account decimal dot. testsuite ChangeLog: 2012-12-26 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/55539 * gfortran.dg/nosigned_zero_3.f90: New testcase. From-SVN: r194717
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog6
-rw-r--r--libgfortran/io/write_float.def9
2 files changed, 12 insertions, 3 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 566a24b..debd88c 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,9 @@
+2012-12-26 Janne Blomqvist <jb@gcc.gnu.org>
+
+ PR fortran/55539
+ * io/write_float.def (output_float): Take into account decimal
+ dot.
+
2012-12-21 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/30162
diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def
index 6521f3c..1e30dde 100644
--- a/libgfortran/io/write_float.def
+++ b/libgfortran/io/write_float.def
@@ -483,16 +483,19 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size,
/* Scan the digits string and count the number of zeros. If we make it
all the way through the loop, we know the value is zero after the
rounding completed above. */
- for (i = 0; i < ndigits; i++)
+ int hasdot = 0;
+ for (i = 0; i < ndigits + hasdot; i++)
{
- if (digits[i] != '0' && digits[i] != '.')
+ if (digits[i] == '.')
+ hasdot = 1;
+ else if (digits[i] != '0')
break;
}
/* To format properly, we need to know if the rounded result is zero and if
so, we set the zero_flag which may have been already set for
actual zero. */
- if (i == ndigits)
+ if (i == ndigits + hasdot)
{
zero_flag = true;
/* The output is zero, so set the sign according to the sign bit unless