This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Fix FMT= with CHARACTER arrays (PR fortran/39865, take 2)
On Tue, May 12, 2009 at 05:44:32PM +0200, Jakub Jelinek wrote:
> On Tue, May 12, 2009 at 03:14:14PM +0200, Jakub Jelinek wrote:
> > The following patch attempts to fix it at least partially, for packed
> > arrays. The size computation should be correct even for non-packed arrays,
> > but in that case we'd need to allocate a temporary and concatenate the array
> > elements into it, possibly with a runtime check whether the temporary needs
> > to be allocated and populated/freed.
> And this updated patch instead should fix it fully, take care of the needed
> packing if the array is not packed.
> To avoid code duplication, I'm using gfc_conv_array_parameter function
> which does almost what we want, except that it doesn't compute the array
> size and the return value in se->expr isn't something from which it could be
> computed. So the patch adds an optional size outgoing argument, if
> non-NULL, the size will be computed, all older callers just pass NULL.
> Ok for trunk if testing succeeds?
OK, with 2 comments below.
> +static void
> +gfc_array_parameter_size (tree desc, gfc_expr *expr, tree *size)
I don't know if this conforms to the Gnu Code Standard, but by
convention the gfortran guys normally do not use the gfc_
prefix on static functions. Yes, there is an inconsistent
adherence to this rule in other code.
> /* Deallocate the allocatable components of structures that are
> --- gcc/fortran/trans-io.c.jj 2009-05-04 16:46:12.000000000 +0200
> +++ gcc/fortran/trans-io.c 2009-05-12 17:29:32.000000000 +0200
> + if (0 && e->expr_type == EXPR_VARIABLE
> + && e->ref->u.ar.type == AR_FULL
> + && e->symtree
> + && e->symtree->n.sym->backend_decl
> + && GFC_DECL_PACKED_ARRAY (e->symtree->n.sym->backend_decl))
Why the '0' in the above?