re PR fortran/32156 (ICE with characters)

2007-05-31  Paul Thomas  <pault@gcc.gnu.org>

	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  <pault@gcc.gnu.org>

	PR fortran/32156
	* gfortran.dg/char_array_constructor_3.f90: New test.

From-SVN: r125241
This commit is contained in:
Paul Thomas 2007-05-31 21:12:10 +00:00
parent cba83c6f79
commit ac5753b796
1 changed files with 11 additions and 1 deletions

View File

@ -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)