diff options
author | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2007-06-24 18:54:50 +0000 |
---|---|---|
committer | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2007-06-24 18:54:50 +0000 |
commit | 69774e69a79a32952263b0ac58c97c332aa6457c (patch) | |
tree | 1be284e226d0a6941565b8506e8d35683325b5ca | |
parent | 2eae3dc776d21ca736df7805977f39af98513b31 (diff) | |
download | gcc-69774e69a79a32952263b0ac58c97c332aa6457c.zip gcc-69774e69a79a32952263b0ac58c97c332aa6457c.tar.gz gcc-69774e69a79a32952263b0ac58c97c332aa6457c.tar.bz2 |
re PR fortran/32446 (F0.n output format fails with large numbers)
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
-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. */ |