summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorMark Eggleston <markeggleston@gcc.gnu.org>2020-08-04 14:10:08 +0100
committerMark Eggleston <markeggleston@gcc.gnu.org>2020-08-20 07:40:55 +0100
commitc2a0fd7c8ff426cc40ec678efef85e4a376ea4b5 (patch)
treedf94cc464dbb4da304a5c733425324b1eb5e2b25 /libgfortran
parent2f5951bd95e334d611f4be7bbe1a136c580f9c20 (diff)
Fortran : rejected f0.d edit descriptor PR96436
Zero length f format descriptors are valid for Fortran 95 and later. For g format descriptors from Fortran 2008 and later. Finally for D, E, EN and ES for Fortran 2018 and later. 2020-08-20 Mark Eggleston <markeggleston@gcc.gnu.org> libgfortran/ PR fortran/96436 * io/format.c (parse_format_list): Add new local variable "standard" to hold the required standard to check. If the format width is zero select standard depending on descriptor. Call notification_std using the new standard variable. 2020-08-20 Mark Eggleston <markeggleston@gcc.gnu.org> gcc/testsuite/ PR fortran/96436 * gfortran.dg/pr96436_1.f90: New test. * gfortran.dg/pr96436_2.f90: New test. * gfortran.dg/pr96436_3.f90: New test. * gfortran.dg/pr96436_4.f90: New test. * gfortran.dg/pr96436_5.f90: New test. * gfortran.dg/pr96436_6.f90: New test. * gfortran.dg/pr96436_7.f90: New test. * gfortran.dg/pr96436_8.f90: New test. * gfortran.dg/pr96436_9.f90 * gfortran.dg/pr96436_10.f90
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/io/format.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libgfortran/io/format.c b/libgfortran/io/format.c
index 3be861fb19c..0959b3d8f84 100644
--- a/libgfortran/io/format.c
+++ b/libgfortran/io/format.c
@@ -617,6 +617,7 @@ parse_format_list (st_parameter_dt *dtp, bool *seen_dd)
int repeat;
format_data *fmt = dtp->u.p.fmt;
bool seen_data_desc = false;
+ int standard;
head = tail = NULL;
@@ -929,7 +930,14 @@ parse_format_list (st_parameter_dt *dtp, bool *seen_dd)
/* Processing for zero width formats. */
if (u == FMT_ZERO)
{
- if (notification_std (GFC_STD_F2008) == NOTIFICATION_ERROR
+ if (t == FMT_F)
+ standard = GFC_STD_F95;
+ else if (t == FMT_G)
+ standard = GFC_STD_F2008;
+ else
+ standard = GFC_STD_F2018;
+
+ if (notification_std (standard) == NOTIFICATION_ERROR
|| dtp->u.p.mode == READING)
{
fmt->error = zero_width;