On Mon, Jun 1, 2015 at 12:43 PM, Eric Botcazou <ebotca...@adacore.com> wrote:
> Hi,
>
> this fixes an ICE on a function returning a variable-sized record type but
> discovered to be no-return by the optimizer.  In this case, the LHS of the
> GIMPLE call statement is removed so the RTL expander attempts to allocate a
> temporary and fails:
>
> eric@polaris:~/build/gcc/native> gcc/gnat1 -quiet varsize_return2.ads -O
> +===========================GNAT BUG DETECTED==============================+
> | 6.0.0 20150531 (experimental) [trunk revision 223897] (x86_64-suse-linux)
> GCC error:|
> | in assign_stack_temp_for_type, at function.c:793
>
> because it too cannot create temporaries of variable size.
>
> The attached patch simply preserves the LHS throughout the GIMPLE pipeline.
> It also simplifies the relevant test in gimplify_modify_expr_rhs, which was
> overly broad.
>
> Tested on x86_64-suse-linux, OK for the mainline?

Ok.  (I wonder if there are any cases where the return value is allocated by the
callee?)

Thanks,
Richard.

>
> 2015-06-01  Eric Botcazou  <ebotca...@adacore.com>
>
>         * gimplify.c (gimplify_modify_expr_rhs): Use simple test on the size.
>         * cgraph.c (cgraph_redirect_edge_call_stmt_to_callee): Do not remove
>         the LHS of a no-return call if its type has variable size.
>         * tree-cfgcleanup.c (fixup_noreturn_call): Likewise.
>         * tree-cfg.c (verify_gimple_call): Accept these no-return calls.
>
>
> 2015-06-01  Eric Botcazou  <ebotca...@adacore.com>
>
>         * gnat.dg/specs/varsize_return2.ads: New test.
>         * gnat.dg/specs/varsize_return2_pkg.ad[sb]: New helper.
>
>
> --
> Eric Botcazou

Reply via email to