[Bug libfortran/39402] gfortran 20090306: internal write of 0.0 with F0.3 gives **
jvdelisle at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon Mar 9 03:36:00 GMT 2009
------- Comment #3 from jvdelisle at gcc dot gnu dot org 2009-03-09 03:35 -------
With the following example:
REAL :: x
CHARACTER(80) :: str
x = 0.0
write (6,'(f0.0)') x
write (6,'(f0.1)') x
write (6,'(f0.2)') x
write (6,'(f0.3)') x
write (6,'(f0.4)') x
END
gfortran gives:
$ gfc pr39409.f90
$ ./a.out
0.
.0
**
**
**
With this patch:
Index: write_float.def
===================================================================
--- write_float.def (revision 144717)
+++ write_float.def (working copy)
@@ -122,7 +122,7 @@ output_float (st_parameter_dt *dtp, cons
/* Handle special cases. */
if (w == 0)
- w = 2;
+ w = d + 2;
/* For this one we choose to not output a decimal point.
F95 10.5.1.2.1 */
The special case for pr37834 is generalized, giving the following result which
matches ifort, sunf95, and Open64 f95.
$ ./a.out
0.
0.0
0.00
0.000
0.0000
I plan to commit this patch to trunk under simple and obvious rule if it passes
regression testing.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39402
More information about the Gcc-bugs
mailing list