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

--- Comment #3 from jpr at csc dot fi 2010-09-30 04:50:05 UTC ---
Hi,

the problem seems to be in expr.c (called from resolve.c:
resolve_allocate_expr())

bool gfc_has_default_initializer (gfc_symbol *der)
{
  gfc_component *c;

  gcc_assert (der->attr.flavor == FL_DERIVED);
  for (c = der->components; c; c = c->next)
    if (c->ts.type == BT_DERIVED)
      {
        if (!c->attr.pointer
             && gfc_has_default_initializer (c->ts.u.derived))
          return true;
      }
    else
      {
        if (c->initializer)
          return true;
      }

  return false;
}

if a derived type has a derived type component it only checks whether
that components components have default initializers, not the component
itself. Additionally the pointer case is masked away. Adding 
|| c->initializer to the conditions solves this trouble but propably 
breaks something else, as the resolving allocate() is not the only place
this gets called.

Juha

Reply via email to