aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2008-10-19 18:36:21 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2008-10-19 18:36:21 +0000
commitf13c001e1a46aa1d4b3cd99cede7a3d07b239d9a (patch)
tree052d70853d0a6388f542edac0afffdd480c73c1e /libgfortran
parenta15138a45ffc3b88fbda897f6a7d818f2c89b017 (diff)
downloadgcc-f13c001e1a46aa1d4b3cd99cede7a3d07b239d9a.zip
gcc-f13c001e1a46aa1d4b3cd99cede7a3d07b239d9a.tar.gz
gcc-f13c001e1a46aa1d4b3cd99cede7a3d07b239d9a.tar.bz2
re PR fortran/37834 (write(*,'(f0.0)') 0.0 prints "." instead of "0.")
2008-10-19 Jerry DeLisle <jvdelisle@gcc.gnu.org PR libfortran/37834 * io/write_float.def (output_float): Emit '0.' for special case of format specifier 'f0.0' and value of zero. Likewise emit '0' for 'f1.0'. From-SVN: r141231
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog6
-rw-r--r--libgfortran/io/write_float.def16
2 files changed, 22 insertions, 0 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index cf3d930..9b2d18d 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,9 @@
+2008-10-19 Jerry DeLisle <jvdelisle@gcc.gnu.org
+
+ PR libfortran/37834
+ * io/write_float.def (output_float): Emit '0.' for special case of
+ format specifier 'f0.0' and value of zero. Likewise emit '0' for 'f1.0'.
+
2008-10-17 Jerry DeLisle <jvdelisle@gcc.gnu.org
PR libfortran/37863
diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def
index 73a6ed1..d55e379 100644
--- a/libgfortran/io/write_float.def
+++ b/libgfortran/io/write_float.def
@@ -119,6 +119,22 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size,
sign = calculate_sign (dtp, sign_bit);
else
sign = calculate_sign (dtp, 0);
+
+ /* Handle special cases. */
+ if (w == 0)
+ w = 2;
+
+ /* For this one we choose to not output a decimal point.
+ F95 10.5.1.2.1 */
+ if (w == 1 && ft == FMT_F)
+ {
+ out = write_block (dtp, w);
+ if (out == NULL)
+ return;
+ *out = '0';
+ return;
+ }
+
}
/* Normalize the fractional component. */