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