This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/55932] [F03] ICE for structure constructor with scalar allocatable component
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 05 Jan 2014 18:42:30 +0000
- Subject: [Bug fortran/55932] [F03] ICE for structure constructor with scalar allocatable component
- Auto-submitted: auto-generated
- References: <bug-55932-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55932
--- Comment #5 from janus at gcc dot gnu.org ---
The following is sufficient to get rid of the ICE:
Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c (revision 206335)
+++ 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)
+ 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);
}
With this patch, the test case in comment 3 compiles without error. However, it
now segfaults at runtime, because alloc-on-assignment is still missing.