aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2020-01-17 11:26:10 -0800
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2020-01-17 11:26:10 -0800
commit82033483fd74b1dcedab416d98673e212258498d (patch)
treed421a53d45895d9869e62fe016679017163cbf87 /libgfortran
parent7e45138702a9c26b00d25db07f92a271b054e304 (diff)
downloadgcc-82033483fd74b1dcedab416d98673e212258498d.zip
gcc-82033483fd74b1dcedab416d98673e212258498d.tar.gz
gcc-82033483fd74b1dcedab416d98673e212258498d.tar.bz2
PR90374 Zero width format specifiers.
PR libfortran/90374 * io/format.c (parse_format_list): Zero width not allowed with FMT_D. * io/write_float.def (build_float_string): Include range of higher exponent values that require wider width.
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog8
-rw-r--r--libgfortran/io/format.c4
-rw-r--r--libgfortran/io/write_float.def4
3 files changed, 14 insertions, 2 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 840642c..bd2d87e 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-17 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/90374
+ * io/format.c (parse_format_list): Zero width not allowed with
+ FMT_D.
+ * io/write_float.def (build_float_string): Include range of
+ higher exponent values that require wider width.
+
2020-01-01 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/90374
diff --git a/libgfortran/io/format.c b/libgfortran/io/format.c
index b42a559..3be861f 100644
--- a/libgfortran/io/format.c
+++ b/libgfortran/io/format.c
@@ -954,7 +954,9 @@ parse_format_list (st_parameter_dt *dtp, bool *seen_dd)
}
tail->u.real.d = fmt->value;
- /* Look for optional exponent */
+ /* Look for optional exponent, not allowed for FMT_D */
+ if (t == FMT_D)
+ break;
u = format_lex (fmt);
if (u != FMT_E)
fmt->saved_token = u;
diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def
index 75c7942..8a1be05 100644
--- a/libgfortran/io/write_float.def
+++ b/libgfortran/io/write_float.def
@@ -497,7 +497,9 @@ build_float_string (st_parameter_dt *dtp, const fnode *f, char *buffer,
else if (f->u.real.e == 0)
{
/* Zero width specified, no leading zeros in exponent */
- if (e > 99 || e < -99)
+ if (e > 999 || e < -999)
+ edigits = 6;
+ else if (e > 99 || e < -99)
edigits = 5;
else if (e > 9 || e < -9)
edigits = 4;