This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[gfortran] PING PATCH write with unspecified width for real output(PRlibfortran/18025)
- From: FranÃois-Xavier Coudert <Francois-Xavier dot Coudert at lcp dot u-psud dot fr>
- To: gfortran <fortran at gcc dot gnu dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 17 Mar 2005 16:15:00 +0100
- Subject: [gfortran] PING PATCH write with unspecified width for real output(PRlibfortran/18025)
- Organization: Laboratoire de Chimie Physique
ping.
This submitted patch fixes PR libfortran/18025. This is a regression WRT g77
but not a bug standardwise.
*strapped and regtested on i686-linux. OK for mainline and 4.0?
2005-02-27 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR libfortran/18025
* write.c (output_float): Handling the "F0.d" format
similarly as commercial compilers.
! PR libfortran/18025 <coudert@clipper.ens.fr>
! {dg-do run}
character(len=80) :: c
write(c, "('#',F0.2,'#')") 1.23
if (c /= '#1.23#') call abort
write(c, "('#',F0.2,'#')") -1.23
if (c /= '#-1.23#') call abort
end
Index: write.c
===================================================================
RCS file: /cvsroot/gcc/gcc/libgfortran/io/write.c,v
retrieving revision 1.23
diff -p -u -r1.23 write.c
--- write.c 21 Feb 2005 19:59:58 -0000 1.23
+++ write.c 27 Feb 2005 17:14:02 -0000
@@ -518,7 +534,7 @@ output_float (fnode *f, double value, in
/* Pick a field size if none was specified. */
if (w <= 0)
- w = nbefore + nzero + nafter + 2;
+ w = nbefore + nzero + nafter + (sign != SIGN_NONE ? 2 : 1);
/* Create the ouput buffer. */
out = write_block (w);