https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69498
koenigni at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |koenigni at gcc dot gnu.org, | |pault at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |koenigni at gcc dot gnu.org --- Comment #5 from koenigni at gcc dot gnu.org --- Proposed fix for z2.f90 and z3.f90. Index: symbol.c =================================================================== --- symbol.c (Revision 246320) +++ symbol.c (Arbeitskopie) @@ -2782,10 +2782,20 @@ void gfc_delete_symtree (gfc_symtree **root, const char *name) { gfc_symtree st, *st0; + const char *p; - st0 = gfc_find_symtree (*root, name); + /* Submodules are marked as mod.submod. When freeing a submodule + symbol, the symtree only has "submod", so adjust that here. */ - st.name = gfc_get_string ("%s", name); + p = strchr(name, '.'); + if (p) + p++; + else + p = name; + + st0 = gfc_find_symtree (*root, p); + + st.name = gfc_get_string ("%s", p); gfc_delete_bbt (root, &st, compare_symtree); free (st0);