This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, fortran] PR24311 - MERGE with character arguments causingICE in IO statements.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]