From: Steven G. Kargl Date: Mon, 2 Jan 2006 22:23:35 +0000 (+0000) Subject: re PR fortran/24640 ([4.1] ice with invalid label) X-Git-Tag: releases/gcc-4.2.0~5081 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=99f1e970919e08ce15113e28618ec93ddc0cddc4;p=thirdparty%2Fgcc.git re PR fortran/24640 ([4.1] ice with invalid label) 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. From-SVN: r109246 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index c8c82da86791..e2f63f6131a3 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2006-01-02 Steven G. Kargl + + PR fortran/24640 + * parse.c (next_free): Check for whitespace after the label. + * match.c (gfc_match_small_literal_int): Initialize cnt variable. + 2006-01-01 Steven G. Kargl * ChangeLog: Split previous years into ... diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index e28127b00b4a..a07de602fbf6 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -151,6 +151,7 @@ gfc_match_small_literal_int (int *value, int *cnt) gfc_gobble_whitespace (); c = gfc_next_char (); + *cnt = 0; if (!ISDIGIT (c)) { diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index a0da4480b8b9..87f36df23fd2 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -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 { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 10f7c252f938..a312fd0c6f8e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-01-02 Steven G. Kargl + + PR fortran/24640 + * gfortran.dg/label_2.f90: New test. + 2006-01-02 Volker Reichelt * g++.dg/lookup/using12.C: Tighten error marker. diff --git a/gcc/testsuite/gfortran.dg/label_2.f90 b/gcc/testsuite/gfortran.dg/label_2.f90 new file mode 100644 index 000000000000..7b87f6c240b8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/label_2.f90 @@ -0,0 +1,10 @@ +! { 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 +