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



--- Comment #11 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-01-01 
14:09:09 UTC ---

(In reply to comment #10)

> I have a simple case where CLASS(*) leads to an ICE.

> If it doesn't fit here, please feel free to move it elsewhere.



The segfault occurs for comp == "_extends" in gfc_default_initializer. The

problem is that  comp->ts.type  is BT_CLASS, which is not handled. As one has

CLASS(*), ts.u.derived == NULL, which breaks the following check:



      if (comp->attr.allocatable

          || (comp->ts.type == BT_CLASS && CLASS_DATA

(comp)->attr.allocatable))



>From class.c's gfc_find_intrinsic_vtab

              if (gfc_add_component (vtype, "_extends", &c) == FAILURE)

              ...

              /* Avoid segfaults because due to character length.   */

              c->ts.type = ts->type == BT_CHARACTER ? BT_VOID : ts->type;

              c->ts.kind = ts->kind;



Thus, either BT_CLASS shouldn't be used - or ts.u.derived has to be used.







By the way, class.c's gfc_find_derived_vtab uses the following if there is no

parent - or for unlimited polymorphic:

                  c->ts.type = BT_DERIVED;

                  c->ts.u.derived = vtype;

                  c->initializer = gfc_get_null_expr (NULL);

Reply via email to