https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88611
--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #5) > But given that the right type we want is already passed in type, I'd say: > --- gcc/trans-expr.c.jj 2019-01-01 12:37:52.000000000 +0100 > +++ gcc/trans-expr.c 2019-01-07 14:41:02.146885618 +0100 > @@ -7085,21 +7085,7 @@ gfc_conv_initializer (gfc_expr * expr, g > the 'expr' to be that for a (void *). */ > if (expr != NULL && expr->ts.type == BT_DERIVED > && expr->ts.is_iso_c && expr->ts.u.derived) > - { > - gfc_symbol *derived = expr->ts.u.derived; > - > - /* The derived symbol has already been converted to a (void *). Use > - its kind. */ > - if (derived->ts.kind == 0) > - derived->ts.kind = gfc_default_integer_kind; > - expr = gfc_get_int_expr (derived->ts.kind, NULL, 0); > - expr->ts.f90_type = derived->ts.f90_type; > - > - gfc_init_se (&se, NULL); > - gfc_conv_constant (&se, expr); > - gcc_assert (TREE_CODE (se.expr) != CONSTRUCTOR); > - return se.expr; > - } > + return build_int_cst (type, 0); > > if (array && !procptr) > { > is best. I regression-tested this, without issues. Pre-approved for trunk (or obvious and simple).