]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/32446 (F0.n output format fails with large numbers)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Sun, 24 Jun 2007 18:54:50 +0000 (18:54 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Sun, 24 Jun 2007 18:54:50 +0000 (18:54 +0000)
2007-06-24  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR libgfortran/32446
* io/write.c (output_float): Calculate ndigits correctly for large
numbered formats that must pad zeros before the decimal point.

From-SVN: r125985

libgfortran/ChangeLog
libgfortran/io/write.c

index 8df6b35529b44a581327c50c906bcacbed13c840..fc31e65a6ec8f2ef8c269f96d37b741beab7ee19 100644 (file)
@@ -1,3 +1,9 @@
+2007-06-24  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR libgfortran/32446
+       * io/write.c (output_float): Calculate ndigits correctly for large
+       numbered formats that must pad zeros before the decimal point.
+
 2007-06-15  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
 
        PR libfortran/32345
index e0c507f4750570a59b8a3bf81255ced09ba85b50..f156d19862be03566b17f8f0b22814169fd9d435 100644 (file)
@@ -810,16 +810,21 @@ output_float (st_parameter_dt *dtp, const fnode *f, GFC_REAL_LARGEST value)
   if (nbefore > 0)
     {
       if (nbefore > ndigits)
-       i = ndigits;
+       {
+         i = ndigits;
+         memcpy (out, digits, i);
+         ndigits = 0;
+         while (i < nbefore)
+           out[i++] = '0';
+       }
       else
-       i = nbefore;
-
-      memcpy (out, digits, i);
-      while (i < nbefore)
-       out[i++] = '0';
+       {
+         i = nbefore;
+         memcpy (out, digits, i);
+         ndigits -= i;
+       }
 
       digits += i;
-      ndigits -= i;
       out += nbefore;
     }
   /* Output the decimal point.  */