diff options
author | Janus Weil <janus@gcc.gnu.org> | 2009-10-22 10:53:26 +0200 |
---|---|---|
committer | Janus Weil <janus@gcc.gnu.org> | 2009-10-22 10:53:26 +0200 |
commit | 76d02e9fa7f8acbbc3fe7a6c5dd6156777f00f24 (patch) | |
tree | 74a64b748e313ef72c5dd3cece6e6507c616170e /gcc/fortran | |
parent | 7e1e7d4cc65dedaf07bbbb367253b569f2311c66 (diff) | |
download | gcc-76d02e9fa7f8acbbc3fe7a6c5dd6156777f00f24.zip gcc-76d02e9fa7f8acbbc3fe7a6c5dd6156777f00f24.tar.gz gcc-76d02e9fa7f8acbbc3fe7a6c5dd6156777f00f24.tar.bz2 |
re PR fortran/41781 ([OOP] bogus undefined label error with SELECT TYPE.)
2009-10-22 Janus Weil <janus@gcc.gnu.org>
PR fortran/41781
* resolve.c (resolve_codes): Don't clear 'cs_base' for BLOCK constructs,
to make sure labels are treated correctly.
* symbol.c (gfc_get_st_label): Create labels in the right namespace.
For BLOCK constructs go into the parent namespace.
2009-10-22 Janus Weil <janus@gcc.gnu.org>
PR fortran/41781
* gfortran.dg/goto_8.f90: New test case.
From-SVN: r153446
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/fortran/resolve.c | 6 | ||||
-rw-r--r-- | gcc/fortran/symbol.c | 11 |
3 files changed, 22 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index b3567e4..6a44080 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2009-10-22 Janus Weil <janus@gcc.gnu.org> + + PR fortran/41781 + * resolve.c (resolve_codes): Don't clear 'cs_base' for BLOCK constructs, + to make sure labels are treated correctly. + * symbol.c (gfc_get_st_label): Create labels in the right namespace. + For BLOCK constructs go into the parent namespace. + 2009-10-21 Janus Weil <janus@gcc.gnu.org> PR fortran/41706 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 8e23308..4c10a0c 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -12053,7 +12053,11 @@ resolve_codes (gfc_namespace *ns) resolve_codes (n); gfc_current_ns = ns; - cs_base = NULL; + + /* Don't clear 'cs_base' if this is the namespace of a BLOCK construct. */ + if (!(ns->proc_name && ns->proc_name->attr.flavor == FL_LABEL)) + cs_base = NULL; + /* Set to an out of range value. */ current_entry_id = -1; diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index 837a357..c1b39b0 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -2030,9 +2030,16 @@ gfc_st_label * gfc_get_st_label (int labelno) { gfc_st_label *lp; + gfc_namespace *ns; + + /* Find the namespace of the scoping unit: + If we're in a BLOCK construct, jump to the parent namespace. */ + ns = gfc_current_ns; + while (ns->proc_name && ns->proc_name->attr.flavor == FL_LABEL) + ns = ns->parent; /* First see if the label is already in this namespace. */ - lp = gfc_current_ns->st_labels; + lp = ns->st_labels; while (lp) { if (lp->value == labelno) @@ -2050,7 +2057,7 @@ gfc_get_st_label (int labelno) lp->defined = ST_LABEL_UNKNOWN; lp->referenced = ST_LABEL_UNKNOWN; - gfc_insert_bbt (&gfc_current_ns->st_labels, lp, compare_st_labels); + gfc_insert_bbt (&ns->st_labels, lp, compare_st_labels); return lp; } |