This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/55932] [F03] ICE for structure constructor with scalar allocatable component


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]