Jerry DeLisle - [patch, libgfortran] PR30910 ES format not quite right... (original) (raw)

This is the mail archive of the gcc-patches@gcc.gnu.orgmailing 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]

Hello all,This trivial patch fixes this problem by only applying the special case for F format specifiers. I have updated the test case within the patch. Thanks to Tobias for tracking in on this.Regression tested on x86-64-Gnu/Linux.OK for Trunk and then 4.2? What about 4.1?Regards,Jerry2007-02-22 Jerry DeLisle jvdelisle@gcc.gnu.org

PR libgfortran/30910
* io/write.c (output_float): Add condition of format F only for
special case rounding with zero precision.

Index: libgfortran/io/write.c

--- libgfortran/io/write.c (revision 122189) +++ libgfortran/io/write.c (working copy) @@ -488,7 +488,7 @@ output_float (st_parameter_dt dtp, cons value = -value; / Special case when format specifies no digits after the decimal point. */ - if (d == 0) + if (d == 0 && ft == FMT_F) { if (value < 0.5) value = 0.0; Index: gcc/testsuite/gfortran.dg/fmt_zero_precision.f90

--- gcc/testsuite/gfortran.dg/fmt_zero_precision.f90 (revision 122189) +++ gcc/testsuite/gfortran.dg/fmt_zero_precision.f90 (working copy) @@ -15,6 +15,35 @@ write(*,100) 333.499 50 format(f3.0,"<") 100 format(f8.0,"<")


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