diff options
author | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-09-06 23:22:26 +0000 |
---|---|---|
committer | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-09-06 23:22:26 +0000 |
commit | 45b4ec58102b53a056b5a84eb27ab8bc64cb6525 (patch) | |
tree | 974e99bcdef6567e75b66f7e17b71216ef5bd746 /libgfortran | |
parent | ef3b531c31307ff8fc2bd7aecf25ee942d4d5574 (diff) |
2016-09-06 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/77393
* io/write_float.def (build_float_string): Recognize when the
result will not fit in the user provided, star fill, and exit
early.
* gfortran.dg/fmt_f0_2.f90: Update test.
* gfortran.dg/fmt_f0_3.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240018 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 7 | ||||
-rw-r--r-- | libgfortran/io/write_float.def | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 256805a3db6..f9ed4b013a4 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,10 @@ +2016-09-16 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libgfortran/77393 + * io/write_float.def (build_float_string): Recognize when the + result will not fit in the user provided, star fill, and exit + early. + 2016-08-31 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/77393 diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def index 04223c043a3..504482fa170 100644 --- a/libgfortran/io/write_float.def +++ b/libgfortran/io/write_float.def @@ -174,6 +174,13 @@ build_float_string (st_parameter_dt *dtp, const fnode *f, char *buffer, { case FMT_F: nbefore = ndigits - precision; + if ((w > 0) && (nbefore > (int) size)) + { + *len = w; + star_fill (result, w); + result[w] = '\0'; + return; + } /* Make sure the decimal point is a '.'; depending on the locale, this might not be the case otherwise. */ digits[nbefore] = '.'; |