summaryrefslogtreecommitdiff
path: root/gcc/fortran/match.c
diff options
context:
space:
mode:
authorkargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-20 19:17:32 +0000
committerkargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-20 19:17:32 +0000
commit43f806841f501262fa771c270d11b64335283e90 (patch)
tree177fdc29aa2e55a7d1462a1b7a3f424f4da2d8d3 /gcc/fortran/match.c
parenteba9b5f1260409f8fedfd77e4a18d49ff80fdc50 (diff)
downloadgcc-43f806841f501262fa771c270d11b64335283e90.tar.gz
PR fortran/21257
(Ported from g95) * match.c (gfc_match_label): Detect duplicate labels. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101214 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/match.c')
-rw-r--r--gcc/fortran/match.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 0592b1e974b..e8c4661e992 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -250,7 +250,6 @@ match
gfc_match_label (void)
{
char name[GFC_MAX_SYMBOL_LEN + 1];
- gfc_state_data *p;
match m;
gfc_new_block = NULL;
@@ -265,18 +264,15 @@ gfc_match_label (void)
return MATCH_ERROR;
}
- if (gfc_new_block->attr.flavor != FL_LABEL
- && gfc_add_flavor (&gfc_new_block->attr, FL_LABEL,
- gfc_new_block->name, NULL) == FAILURE)
- return MATCH_ERROR;
+ if (gfc_new_block->attr.flavor == FL_LABEL)
+ {
+ gfc_error ("Duplicate construct label '%s' at %C", name);
+ return MATCH_ERROR;
+ }
- for (p = gfc_state_stack; p; p = p->previous)
- if (p->sym == gfc_new_block)
- {
- gfc_error ("Label %s at %C already in use by a parent block",
- gfc_new_block->name);
- return MATCH_ERROR;
- }
+ if (gfc_add_flavor (&gfc_new_block->attr, FL_LABEL,
+ gfc_new_block->name, NULL) == FAILURE)
+ return MATCH_ERROR;
return MATCH_YES;
}