[patch] honor DECL_BY_REFERENCE on CALL_EXPR exp in aggregate_value_p

Richard Guenther richard.guenther@gmail.com
Sat Jun 24 18:36:00 GMT 2006


On 6/24/06, Olivier Hainque <hainque@adacore.com> wrote:
> Hello,
>
> With the GCC 3.4 series, a front-end requesting a function to return
> by invisible reference used to merely have to set TREE_ADDRESSABLE on
> the proper types.
>
> Current mainline now expects everything to be exposed explicitely, as
> illustrated by cp_genericize for C++, for instance. Amongst other things,
> the function result decl is marked DECL_BY_REFERENCE and the associated
> type is made an explicit reference type.
>
> The Ada front-end has not gone through this transition yet and relies on the
> gimplifier for temporary creations in a number of circumstances.
>
> One kind of observable effect is ICEs from attempts at creating temporaries of
> TREE_ADDRESSABLE type, e.g. while compiling check_result_by_ref.adb in the
> testcase below.
>
> We are working at resolving this issue.  Part of our current scheme consists
> in unsetting the TREE_ADDRESSABLE flag on the function type, which prevents
> part of the middle-end magic to work - in particular, the following bits from
> expand_call:
>
>      /* Set up a place to return a structure.  */
>      ...
>      if (aggregate_value_p (exp, fndecl))
>
> The attached patch is a simple helper for the aforementioned expand_call
> issue, preriquisite for a larger change to come, hence part of a regression
> fix.
>
> Bootstrapped and successfully regression tested with languages=all,ada
> on i686-pc-linux-gnu.
>
> 2006-06-24  Olivier Hainque  <hainque@adacore.com>
>
>         * function.c (aggregate_value_p): Honor DECL_BY_REFERENCE on
>         a CALL_EXPR target function declaration.

You should at least add a comment before the check to explain what is
going on.

Thanks,
Richard.



More information about the Gcc-patches mailing list