Hello everyone,
this fixes the ICE. The problem was a discrepancy between the name of
the submodules symbol and the name of its symtree node.
Nicolas
2017-03-18 Nicolas Koenig <koeni...@student.ethz.ch>
PR fortran/69498
* symbol.c (gfc_delete_symtree): If there is a period
in the name, ignore
everything before it.
2017-03-18 Nicolas Koenig <koeni...@student.ethz.ch>
PR fortran/69498
* gfortran.dg/submodule_unexp.f90: New test
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);
! { dg-do compile }
! PR fortran/69498
! This used to ICE
program p
type t
submodule (m) sm ! { dg-error "Unexpected SUBMODULE statement at" }
end type
end