diff options
-rw-r--r-- | libgfortran/ChangeLog | 6 | ||||
-rw-r--r-- | libgfortran/io/write.c | 19 |
2 files changed, 18 insertions, 7 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 8df6b35..fc31e65 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -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 diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index e0c507f4..f156d19 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. */ |