This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/49954] ICE assigning concat expression to an array deferred-length string (realloc on assignment)
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 3 Aug 2011 09:26:28 +0000
- Subject: [Bug fortran/49954] ICE assigning concat expression to an array deferred-length string (realloc on assignment)
- Auto-submitted: auto-generated
- References: <bug-49954-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49954
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-08-03 09:26:09 UTC ---
I thought about something like:
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -7322,8 +7322,8 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
/* Get the new lhs size in bytes. */
if (expr1->ts.type == BT_CHARACTER && expr1->ts.deferred)
{
- tmp = expr2->ts.u.cl->backend_decl;
- gcc_assert (expr1->ts.u.cl->backend_decl);
+ tmp = rss->string_length;
+ gcc_assert (expr1->ts.u.cl->backend_decl && tmp);
tmp = fold_convert (TREE_TYPE (expr1->ts.u.cl->backend_decl), tmp);
gfc_add_modify (&fblock, expr1->ts.u.cl->backend_decl, tmp);
}
However, that yields ".array_length" (i.e. the LHS) even for
array_string(:)(1:1)
which has the length 1. However, at a glance, gfc_conv_concat_op seems to
properly set "se->string_length = len". Maybe it is not properly called for
rse->string_length?