From: Jerry DeLisle Date: Sun, 24 Jun 2007 18:54:50 +0000 (+0000) Subject: re PR fortran/32446 (F0.n output format fails with large numbers) X-Git-Tag: releases/gcc-4.3.0~4314 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=69774e69a79a32952263b0ac58c97c332aa6457c;p=thirdparty%2Fgcc.git re PR fortran/32446 (F0.n output format fails with large numbers) 2007-06-24 Jerry DeLisle 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 --- diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 8df6b35529b4..fc31e65a6ec8 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2007-06-24 Jerry DeLisle + + 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 PR libfortran/32345 diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index e0c507f47505..f156d19862be 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -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. */