public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Eric Botcazou <ebotcazou@adacore.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch] Fix ICE on function [not] returning variable size
Date: Mon, 01 Jun 2015 11:19:00 -0000	[thread overview]
Message-ID: <CAFiYyc0d7qt3N1P5-wF-sT804twNd2KJfDXC3pGbYGDcMniPoA@mail.gmail.com> (raw)
In-Reply-To: <2953955.A7ElB1Yu05@polaris>

On Mon, Jun 1, 2015 at 12:43 PM, Eric Botcazou <ebotcazou@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  <ebotcazou@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  <ebotcazou@adacore.com>
>
>         * gnat.dg/specs/varsize_return2.ads: New test.
>         * gnat.dg/specs/varsize_return2_pkg.ad[sb]: New helper.
>
>
> --
> Eric Botcazou

  reply	other threads:[~2015-06-01 11:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01 10:45 Eric Botcazou
2015-06-01 11:19 ` Richard Biener [this message]
2015-06-01 21:10   ` Eric Botcazou
2015-06-02  8:30     ` Richard Biener
2015-06-02  9:30       ` Eric Botcazou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFiYyc0d7qt3N1P5-wF-sT804twNd2KJfDXC3pGbYGDcMniPoA@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).