On Thu, Feb 02, 2006 at 12:39:41AM +0100, Paul Thomas wrote: > H. J > > This regtests OK and simplifies things somewhat: >
What is this format? I don't think I can apply it cleanly? H.J. --- > Index: gcc/fortran/trans-array.c > =================================================================== > *** gcc/fortran/trans-array.c (revision 110407) > --- gcc/fortran/trans-array.c (working copy) > *************** gfc_conv_expr_descriptor (gfc_se * se, g > *** 3911,3917 **** > loop.temp_ss = gfc_get_ss (); > loop.temp_ss->type = GFC_SS_TEMP; > loop.temp_ss->next = gfc_ss_terminator; > ! if (expr->ts.type == BT_CHARACTER) > { > gcc_assert (expr->ts.cl && expr->ts.cl->length > && expr->ts.cl->length->expr_type == EXPR_CONSTANT); > --- 3911,3919 ---- > loop.temp_ss = gfc_get_ss (); > loop.temp_ss->type = GFC_SS_TEMP; > loop.temp_ss->next = gfc_ss_terminator; > ! > ! if (expr->ts.type == BT_CHARACTER > ! && expr->ts.cl->backend_decl == NULL_TREE) > { > gcc_assert (expr->ts.cl && expr->ts.cl->length > && expr->ts.cl->length->expr_type == EXPR_CONSTANT); > *************** gfc_conv_expr_descriptor (gfc_se * se, g > *** 3920,3935 **** > expr->ts.cl->length->ts.kind); > expr->ts.cl->backend_decl = loop.temp_ss->string_length; > } > ! loop.temp_ss->data.temp.type = gfc_typenode_for_spec (&expr->ts); > > /* ... which can hold our string, if present. */ > ! if (expr->ts.type == BT_CHARACTER) > ! { > ! loop.temp_ss->string_length = TYPE_SIZE_UNIT (loop.temp_ss->data.temp. > type); > ! se->string_length = loop.temp_ss->string_length; > ! } > ! else > ! loop.temp_ss->string_length = NULL; > loop.temp_ss->data.temp.dimen = loop.dimen; > gfc_add_ss_to_loop (&loop, loop.temp_ss); > } > --- 3922,3933 ---- > expr->ts.cl->length->ts.kind); > expr->ts.cl->backend_decl = loop.temp_ss->string_length; > } > ! > ! loop.temp_ss->data.temp.type = gfc_typenode_for_spec (&expr->ts); > > /* ... which can hold our string, if present. */ > ! se->string_length = loop.temp_ss->string_length; > ! > loop.temp_ss->data.temp.dimen = loop.dimen; > gfc_add_ss_to_loop (&loop, loop.temp_ss); > } > > giving: > > if (need_tmp) > { > /* Tell the scalarizer to make a temporary. */ > loop.temp_ss = gfc_get_ss (); > loop.temp_ss->type = GFC_SS_TEMP; > loop.temp_ss->next = gfc_ss_terminator; > > if (expr->ts.type == BT_CHARACTER > && expr->ts.cl->backend_decl == NULL_TREE) /* GET THE CHARLEN */ > { > gcc_assert (expr->ts.cl && expr->ts.cl->length > && expr->ts.cl->length->expr_type == EXPR_CONSTANT); > loop.temp_ss->string_length = gfc_conv_mpz_to_tree > (expr->ts.cl->length->value.integer, > expr->ts.cl->length->ts.kind); > expr->ts.cl->backend_decl = loop.temp_ss->string_length; > } > > loop.temp_ss->data.temp.type = gfc_typenode_for_spec (&expr->ts); /* > PASS IT TO TEMP */ > > /* ... which can hold our string, if present. */ > se->string_length = loop.temp_ss->string_length; /* THEN WE MUST WRITE > TO SE */ > > loop.temp_ss->data.temp.dimen = loop.dimen; > gfc_add_ss_to_loop (&loop, loop.temp_ss); > } > > Paul T >