[PATCH] fortran/24640 -- invalid statement label
Steve Kargl
sgk@troutmask.apl.washington.edu
Mon Jan 2 18:28:00 GMT 2006
The attached patch has been regression tested on
i386-*-freebsd. There were no regressions. There were
two problems. First, next_free did not check to see if
a statement label was followed by whitespace. Second,
we were not initializing the cnt variable, so it was
set to random garbage in memory.
2006-01-02 Steven G. Kargl <kargls@comcast.net>
PR fortran/24640
* parse.c (next_free): Check for whitespace after the label.
* match.c (gfc_match_small_literal_int): Initialize cnt variable.
* gfortran.dg/label_2.f90: New test.
--
Steve
-------------- next part --------------
! { dg-do compile }
! PR fortran/24640. We needed to check that whitespace follows
! a statement label in free form.
!
program pr24640
10: a=10 ! { dg-error "character in statement" }
end program
-------------- next part --------------
Index: parse.c
===================================================================
--- parse.c (revision 109225)
+++ parse.c (working copy)
@@ -334,6 +334,10 @@ next_free (void)
do
c = gfc_next_char ();
while (ISDIGIT(c));
+
+ if (!gfc_is_whitespace (c))
+ gfc_error_now ("Non-numeric character in statement label at %C");
+
}
else
{
Index: match.c
===================================================================
--- match.c (revision 109225)
+++ match.c (working copy)
@@ -151,6 +151,7 @@ gfc_match_small_literal_int (int *value,
gfc_gobble_whitespace ();
c = gfc_next_char ();
+ *cnt = 0;
if (!ISDIGIT (c))
{
More information about the Gcc-patches
mailing list