[Patch, fortran] PR47592 - Multiple function invocation with ALLOCATE (SOURCE=REPEAT('x',bar()))
Paul Richard Thomas
paul.richard.thomas@gmail.com
Sun Feb 6 12:17:00 GMT 2011
Dear Tobias,
I thought that you were not doing gfortran this weekend :-)
> Note that I have removed the calls of gfc_start_block and replaced
> them with gfc_init_block, since the former does all sorts of strange
> things with declarations as the warning in trans.c indicates.
>
> I think there are several places in gfortran where an init_block would be
> better than a start_block.
Indeed - I have been burned more than once by using start, rather than init.
>
> Bootstraps and regtests on FC9/x86_64 - OK for trunk?
>
> OK, though you could consider shortening the code as indicated below. Thanks
> for the patch!
>
> +
> ! ref = expr->ref;
> ! /* Find the last reference in the chain. */
> ! while (ref && ref->next != NULL)
> ! {
> ! gcc_assert (ref->type != REF_ARRAY || ref->u.ar.type ==
> AR_ELEMENT);
> ! ref = ref->next;
> ! }
> ! if (!ref)
> ! allocatable = expr->symtree->n.sym->attr.allocatable;
> ! else
> ! allocatable = ref->u.c.component->attr.allocatable;
> !
> ! if (allocatable)
>
>
> That's mostly unchanged from previous version, but couldn't one replace it
> by a simple "if (gfc_expr_attr (expr).allocatable)"? I think gfc_expr_attr
> does not always do the right thing (regarding when to ignore and not ignore
> array/substring refs), but I think here it does.
I'll give it a try. Thanks for the review. Now to module backend_decls.....
Cheers
Paul
More information about the Fortran
mailing list