[Bug fortran/61767] [OOP] ICE in generate_finalization_wrapper at fortran/class.c:1491
janus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Nov 25 16:57:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61767
--- Comment #5 from janus at gcc dot gnu.org ---
The most immediate way to fix it is this:
Index: gcc/fortran/class.c
===================================================================
--- gcc/fortran/class.c (revision 242875)
+++ gcc/fortran/class.c (working copy)
@@ -1569,10 +1569,10 @@ generate_finalization_wrapper (gfc_symbol *derived
/* If there is no new finalizer and no new allocatable, return with
an expr to the ancestor's one. */
- if (!expr_null_wrapper && !finalizable_comp
+ if (ancestor_wrapper && !expr_null_wrapper && !finalizable_comp
&& (!derived->f2k_derived || !derived->f2k_derived->finalizers))
{
- gcc_assert (ancestor_wrapper && ancestor_wrapper->ref == NULL
+ gcc_assert (ancestor_wrapper->ref == NULL
&& ancestor_wrapper->expr_type == EXPR_VARIABLE);
vtab_final->initializer = gfc_copy_expr (ancestor_wrapper);
vtab_final->ts.interface = vtab_final->initializer->symtree->n.sym;
This gets rid of the ICE on the given test case. I will check if it survives a
full regtest.
However one can wonder why we run into generate_finalization_wrapper for the
type MessageTemplate at all (which is not finalizable). It seems we do that for
all types that are used polymorphically, but I'm not sure it is really
necessary. Have to think about this some more.
More information about the Gcc-bugs
mailing list