This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[patch, fortran] PR36725 g0 edit descriptor: Missing compile-time checking for invalid g0.d
- From: Jerry DeLisle <jvdelisle at verizon dot net>
- To: Fortran List <fortran at gcc dot gnu dot org>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 13 Jul 2008 06:45:23 -0700
- Subject: [patch, fortran] PR36725 g0 edit descriptor: Missing compile-time checking for invalid g0.d
This patch is fairly straight forward and provides the compile time error
message as appropriate.
Regression tested on x86-64.
OK for commit?
Jerry
2008-07-13 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/36725
* io.c: Add error check for g0 edit descriptor followed by '.'.
Index: io.c
===================================================================
--- io.c (revision 137403)
+++ io.c (working copy)
@@ -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 d (G0.d) 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)
! { dg-do compile }
! { dg-options "-std=f2008" }
! PR36725 Compile time error for g0 edit descriptor
print '(g0.9)', 0.1 ! { dg-error "Specifying d" }
end