From: Paul Thomas Date: Thu, 31 May 2007 21:12:10 +0000 (+0000) Subject: re PR fortran/32156 (ICE with characters) X-Git-Tag: releases/gcc-4.3.0~4797 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ac5753b796593af16f52cdab931d1768875e5ea8;p=thirdparty%2Fgcc.git re PR fortran/32156 (ICE with characters) 2007-05-31 Paul Thomas PR fortran/32156 * trans-array.c (gfc_trans_array_constructor): Treat the case where the ss expression charlen is missing. 2007-05-31 Paul Thomas PR fortran/32156 * gfortran.dg/char_array_constructor_3.f90: New test. From-SVN: r125241 --- diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index efff3fd655d0..a923871be0bb 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -1635,8 +1635,18 @@ gfc_trans_array_constructor (gfc_loopinfo * loop, gfc_ss * ss) if (!ss->string_length) gfc_todo_error ("complex character array constructors"); - ss->expr->ts.cl->backend_decl = ss->string_length; + /* It is surprising but still possible to wind up with expressions that + lack a character length. + TODO Find the offending part of the front end and cure this properly. + Concatenation involving arrays is the main culprit. */ + if (!ss->expr->ts.cl) + { + ss->expr->ts.cl = gfc_get_charlen (); + ss->expr->ts.cl->next = gfc_current_ns->cl_list; + gfc_current_ns->cl_list = ss->expr->ts.cl->next; + } + ss->expr->ts.cl->backend_decl = ss->string_length; type = gfc_get_character_type_len (ss->expr->ts.kind, ss->string_length); if (const_string)