From 41d6f399b58f31cd3842367701370401e0c2892c Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Mon, 14 Jul 2008 00:51:44 +0000 Subject: [PATCH] re PR fortran/36725 (g0 edit descriptor: Missing compile-time checking for invalid g0.d) 2008-07-13 Jerry DeLisle PR fortran/36725 * io.c: Add error check for g0 edit descriptor followed by '.'. From-SVN: r137769 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/io.c | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index d79a72e73ec..dff3e29161c 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2008-07-13 Jerry DeLisle + + PR fortran/36725 + * io.c: Add error check for g0 edit descriptor followed by '.'. + 2008-07-12 Daniel Kraft * resolve.c (resolve_fl_derived): Allow pointer components to empty diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 3494e8e863f..23bf5f92216 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -477,6 +477,7 @@ check_format (bool is_input) const char *unexpected_element = _("Unexpected element"); const char *unexpected_end = _("Unexpected end of format string"); const char *zero_width = _("Zero width in format descriptor"); + const char *g0_precision = _("Specifying precision with G0 not allowed"); const char *error; format_token t, u; @@ -694,9 +695,19 @@ data_desc: error = zero_width; goto syntax; } - else - return gfc_notify_std (GFC_STD_F2008, "Fortran F2008: 'G0' in " - "format at %C"); + + if (gfc_notify_std (GFC_STD_F2008, "Fortran F2008: 'G0' in " + "format at %C") == FAILURE) + return FAILURE; + + u = format_lex (); + if (u == FMT_PERIOD) + { + error = g0_precision; + goto syntax; + } + saved_token = u; + goto between_desc; } if (u == FMT_ERROR) -- 2.30.2