aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/parse.c')
-rw-r--r--gcc/fortran/parse.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index cb9460fac28..6306cc4c4a8 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -410,7 +410,7 @@ static gfc_statement
next_free (void)
{
match m;
- int c, d;
+ int c, d, cnt;
gfc_gobble_whitespace ();
@@ -419,30 +419,27 @@ next_free (void)
if (ISDIGIT (c))
{
/* Found a statement label? */
- m = gfc_match_st_label (&gfc_statement_label, 0);
+ m = gfc_match_st_label (&gfc_statement_label);
d = gfc_peek_char ();
if (m != MATCH_YES || !gfc_is_whitespace (d))
{
+ gfc_match_small_literal_int (&c, &cnt);
+
+ if (cnt > 5)
+ gfc_error_now ("Too many digits in statement label at %C");
+
+ if (c == 0)
+ gfc_error_now ("Statement label at %C is zero");
+
do
- {
- /* Skip the bad statement label. */
- gfc_warning_now ("Ignoring bad statement label at %C");
- c = gfc_next_char ();
- }
- while (ISDIGIT (c));
+ c = gfc_next_char ();
+ while (ISDIGIT(c));
}
else
{
label_locus = gfc_current_locus;
- if (gfc_statement_label->value == 0)
- {
- gfc_warning_now ("Ignoring statement label of zero at %C");
- gfc_free_st_label (gfc_statement_label);
- gfc_statement_label = NULL;
- }
-
gfc_gobble_whitespace ();
if (gfc_match_eos () == MATCH_YES)