[Bug fortran/55932] [F03] ICE for structure constructor with scalar allocatable component
janus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jan 9 21:49:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55932
--- Comment #7 from janus at gcc dot gnu.org ---
(In reply to janus from comment #6)
> > The following is sufficient to get rid of the ICE:
>
> Unfortunately it produces several testsuite failures:
All of them are fixed by this version:
Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c (revision 206462)
+++ gcc/fortran/trans-expr.c (working copy)
@@ -6049,6 +6049,8 @@ gfc_trans_subcomponent_assign (tree dest, gfc_comp
if (cm->ts.type == BT_CHARACTER)
lse.string_length = cm->ts.u.cl->backend_decl;
lse.expr = dest;
+ if (cm->attr.allocatable && expr->expr_type != EXPR_NULL)
+ lse.expr = build_fold_indirect_ref_loc (input_location, lse.expr);
tmp = gfc_trans_scalar_assign (&lse, &se, cm->ts, true, false, true);
gfc_add_expr_to_block (&block, tmp);
}
More information about the Gcc-bugs
mailing list