summaryrefslogtreecommitdiff
path: root/libgfortran/io/write_float.def
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/io/write_float.def')
-rw-r--r--libgfortran/io/write_float.def7
1 files changed, 7 insertions, 0 deletions
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] = '.';