diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2006-08-29 04:51:32 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2006-08-29 04:51:32 +0000 |
commit | d218d0e66d1144e1a727c13fb0586c82b4fc3d87 (patch) | |
tree | 3e08d5448036b39d4836ec041f5f02403a2e6231 /gcc/fortran/symbol.c | |
parent | bb6e56215c46410b8e3422dd10d2eab27df148bd (diff) | |
download | gcc-d218d0e66d1144e1a727c13fb0586c82b4fc3d87.zip gcc-d218d0e66d1144e1a727c13fb0586c82b4fc3d87.tar.gz gcc-d218d0e66d1144e1a727c13fb0586c82b4fc3d87.tar.bz2 |
re PR fortran/28788 (ICE on valid code)
2006-08-29 Paul Thomas <pault@gcc.gnu.org>
PR fortran/28788
REGRESSION FIX
* symbol.c (gfc_use_derived): Never eliminate the symbol,
following reassociation of use associated derived types.
2006-08-29 Paul Thomas <pault@gcc.gnu.org>
PR fortran/28788
* gfortran.dg/used_types_5.f90: New test.
* gfortran.dg/used_types_6.f90: New test.
From-SVN: r116552
Diffstat (limited to 'gcc/fortran/symbol.c')
-rw-r--r-- | gcc/fortran/symbol.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index c36c456..450f7cf 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -1495,16 +1495,10 @@ gfc_use_derived (gfc_symbol * sym) if (s == NULL || s->attr.flavor != FL_DERIVED) { - /* Check to see if type has been renamed in parent namespace. - Leave cleanup of local symbols until the end of the - compilation because doing it here is complicated by - multiple association with the same type. */ + /* Check to see if type has been renamed in parent namespace. */ s = find_renamed_type (sym, sym->ns->parent->sym_root); if (s != NULL) - { - switch_types (sym->ns->sym_root, sym, s); - return s; - } + goto return_use_assoc; /* See if sym is identical to renamed, use-associated derived types in sibling namespaces. */ @@ -1521,10 +1515,7 @@ gfc_use_derived (gfc_symbol * sym) s = find_renamed_type (sym, ns->sym_root); if (s != NULL) - { - switch_types (sym->ns->sym_root, sym, s); - return s; - } + goto return_use_assoc; } } @@ -1557,6 +1548,9 @@ gfc_use_derived (gfc_symbol * sym) t->derived = s; } + if (sym->attr.use_assoc) + goto return_use_assoc; + st = gfc_find_symtree (sym->ns->sym_root, sym->name); st->n.sym = s; @@ -1573,6 +1567,14 @@ gfc_use_derived (gfc_symbol * sym) return s; +return_use_assoc: + /* Use associated types are not freed at this stage because some + references remain to 'sym'. We retain the symbol and leave it + to be cleaned up by gfc_free_namespace, at the end of the + compilation. */ + switch_types (sym->ns->sym_root, sym, s); + return s; + bad: gfc_error ("Derived type '%s' at %C is being used before it is defined", sym->name); |