[Patch, fortran] PR24311 - MERGE with character arguments causing ICE in IO statements.

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Wed Oct 12 10:49:00 GMT 2005


Paul Thomas wrote:
> +   /* Merge is unusual in that tsource can be a character constant, whose typespec
> +      is transferred to that of the output array.  This will not have had a charlen
> +      created, so it is done here to prevent the middle-end being hit by an
> +      apparently incomplete character array(PR24311).  */

Wouldn't this be true for all other array transformational functions as well?

> +   if (tsource->expr_type == EXPR_CONSTANT
> + 	&& tsource->ts.type == BT_CHARACTER
> + 	&& tsource->ts.cl == NULL)
> +     {
> +       tsource->ts.cl = gfc_get_charlen ();
> +       tsource->ts.cl->next = gfc_current_ns->cl_list;
> +       gfc_current_ns->cl_list = tsource->ts.cl;
> +       tsource->ts.cl->length = gfc_int_expr (tsource->value.character.length);
> +     }

Shouldn't this have happened much earlier?  I.e. expr->ts.cl->length should be
expr->value.character.length, at least after constant substrings have been
evaluated?

- Tobi



More information about the Fortran mailing list