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



--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-01-03 
14:46:54 UTC ---

The problem seems to be the "gfc_class_null_initializer", where "ts" is

unlimited polymorphic and "init_expr" is of type "__class__$tar_a" (and

EXPR_NULL). The latter leads to the generation of __vtab_CLASS_0_ with the

associated _copy function.



Besides the wrong type, the generation _copy is triggered very late, namely in

gfc_trans_deferred_vars-> gfc_trans_structure_assign. That's the reason for

using the wrong scope and - hence - for the ICE.





Patch:



--- a/gcc/fortran/class.c

+++ b/gcc/fortran/class.c

@@ -414,7 +414,7 @@ gfc_class_null_initializer (gfc_typespec *ts, gfc_expr

*init_expr)

       && ts->u.derived->components->ts.u.derived->attr.unlimited_polymorphic;



   if (is_unlimited_polymorphic && init_expr)

-    vtab = gfc_find_intrinsic_vtab (&(init_expr->ts));

+    vtab = gfc_find_intrinsic_vtab (&ts->u.derived->components->ts);

   else

     vtab = gfc_find_derived_vtab (ts->u.derived);

Reply via email to