http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48692

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-04-19 
22:28:34 UTC ---
(In reply to comment #2)
> That also nicely works - the symbol only pops up suddenly when calling
> gfc_dump_module, which seems to be a bug in gfc_dump_module.

More precisely, it occurs for gfc_dump_module -> write_module -> write_symbol0.

If one digs further, one finds that this calls: write_symbol -> mio_symbol ->
mio_array_spec -> fix_mio_expr -> gfc_get_symbol -> gfc_get_sym_tree. And the
latter causes the dangling "changed_syms".


Draft patch:

--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -3007,18 +3007,19 @@ fix_mio_expr (gfc_expr *e)
       /* This is probably a reference to a private procedure from another
         module.  To prevent a segfault, make a generic with no specific
         instances.  If this module is used, without the required
         specific coming from somewhere, the appropriate error message
         is issued.  */
       gfc_get_symbol (fname, gfc_current_ns, &sym);
       sym->attr.flavor = FL_PROCEDURE;
       sym->attr.generic = 1;
       e->symtree = gfc_find_symtree (gfc_current_ns->sym_root, fname);
+      gfc_commit_symbol (sym);
     }
 }


 /* Read and write expressions.  The form "()" is allowed to indicate a
    NULL expression.  */

 static void
 mio_expr (gfc_expr **ep)

Reply via email to