This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran] PATCH formatted write of 0.0 (PR libfortran/20101)


Here is the requested testcase. I have changed the patch and Changelog entry since you already committed the fix for the typo. Here are the two Changelog entries for the fix to libgfortran (pr20101.diff) and testcase (write_0_pe_format.f90).

2005-02-27 FranÃois-Xavier Coudert <coudert@clipper.ens.fr>

	PR libfortran/20101
	* write.c (output_float): Adding special check for value 0.0 in
	  PE format.


2005-02-27 FranÃois-Xavier Coudert <coudert@clipper.ens.fr>


	PR libfortran/20101
	* gfortran.dg/write_0_pe_format.f90: New test.
Index: libgfortran/io/write.c
===================================================================
RCS file: /cvsroot/gcc/gcc/libgfortran/io/write.c,v
retrieving revision 1.23
diff -u -p -r1.23 write.c
@@ -375,7 +380,8 @@ output_float (fnode *f, double value, in
     case FMT_E:
     case FMT_D:
       i = g.scale_factor;
-      e -= i;
+      if (value != 0)
+        e -= i;
       if (i < 0)
        {
          nbefore = 0;
! { dg-do run }
! PR libfortran/20101
! With format "PE", 0.0 must still have "+00" as exponent
character(len=10) :: c1, c2
write(c1,"(1pe9.2)") 0.0
write(c2,"(1pe9.2)") 1.0
if (trim(adjustl(c1)) .ne. "0.00E+00") call abort()
if (trim(adjustl(c2)) .ne. "1.00E+00") call abort()
end

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]