aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/symbol.c
diff options
context:
space:
mode:
authorMikael Morin <mikael.morin@sfr.fr>2011-08-18 23:39:42 +0200
committerMikael Morin <mikael@gcc.gnu.org>2011-08-18 21:39:42 +0000
commit4ee3237e0b5796d047d0b9f01fbe0277ff14d083 (patch)
treefeabc159e1ce25b8141bef017a5b572e13771166 /gcc/fortran/symbol.c
parentbbceee64bef15b92b1f9b964b8d371bd07ea794a (diff)
downloadgcc-4ee3237e0b5796d047d0b9f01fbe0277ff14d083.zip
gcc-4ee3237e0b5796d047d0b9f01fbe0277ff14d083.tar.gz
gcc-4ee3237e0b5796d047d0b9f01fbe0277ff14d083.tar.bz2
re PR fortran/50071 (gfortran does not distinguish labels in different type scoping units)
2011-08-18 Mikael Morin <mikael.morin@sfr.fr> PR fortran/50071 * symbol.c (gfc_get_st_label): Use the derived type namespace when we are parsing a derived type definition. 2011-08-18 Mikael Morin <mikael.morin@sfr.fr> PR fortran/50071 * gfortran.dg/duplicate_labels_2.f: New test. From-SVN: r177882
Diffstat (limited to 'gcc/fortran/symbol.c')
-rw-r--r--gcc/fortran/symbol.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index b761cdd..4463460 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -2127,11 +2127,16 @@ 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;
+ if (gfc_current_state () == COMP_DERIVED)
+ ns = gfc_current_block ()->f2k_derived;
+ else
+ {
+ /* 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 = ns->st_labels;