diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 8df6b35529b..fc31e65a6ec 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 e0c507f4750..f156d19862b 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. */