Hi,

a recent patch by yours truly caused incorrect output for the
combination of scale factor, the value containing initial zeroes, and
F editing. Fixed by moving the removal of the initial zeros until
after the scale factor has been applied to the value. Committed the
patch below as obvious after regtesting and running the NIST
testsuite.

Index: ChangeLog
===================================================================
--- ChangeLog   (revision 185485)
+++ ChangeLog   (working copy)
@@ -1,3 +1,9 @@
+2012-03-17  Janne Blomqvist  <j...@gcc.gnu.org>
+
+       PR libfortran/52608
+       * io/write_float.def (output_float): Move removal of initial zeros
+       until after the scale factor has been applied.
+
 2012-03-16  Janne Blomqvist  <j...@gcc.gnu.org>

        * io/unix.h (struct stream): Rename to stream_vtable.
Index: io/write_float.def
===================================================================
--- io/write_float.def  (revision 185485)
+++ io/write_float.def  (working copy)
@@ -180,12 +180,6 @@ output_float (st_parameter_dt *dtp, cons
       /* Make sure the decimal point is a '.'; depending on the
         locale, this might not be the case otherwise.  */
       digits[nbefore] = '.';
-      if (digits[0] == '0' && nbefore == 1)
-       {
-         digits++;
-         nbefore--;
-         ndigits--;
-       }
       if (p != 0)
        {
          if (p > 0)
@@ -229,6 +223,13 @@ output_float (st_parameter_dt *dtp, cons
          nafter = d;
        }

+      while (digits[0] == '0' && nbefore > 0)
+       {
+         digits++;
+         nbefore--;
+         ndigits--;
+       }
+
       expchar = 0;
       /* If we need to do rounding ourselves, get rid of the dot by
         moving the fractional part.  */


-- 
Janne Blomqvist

Reply via email to