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 PR middle-end/65958
Date: Wed, 18 Nov 2015 10:25:00 -0000	[thread overview]
Message-ID: <CAFiYyc2eRFafhB54BNcuGp+ZpAfZzRhvpg0+wU1F5qVxJ3eCXQ@mail.gmail.com> (raw)
In-Reply-To: <1750746.G8iFFmz9eE@polaris>

On Wed, Nov 18, 2015 at 11:06 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> this is the underlying issue of PR middle-end/65958: the compiler generates
> wrong code when alloca is used in conjunction with a VLA since the latter
> causes the stack space allocated to the former to be wrongly reclaimed.
> So the proposed fix is not to reclaim any stack space in this case.
>
> Bootstrapped/regtested on x86_64-suse-linux, OK for mainline and 5.x branch?

Ok.  I wonder if we document GCCs VLA implementation somewhere so we can add
a note on the interaction with alloca.

Thanks,
Richard.

>
> 2015-11-18  Eric Botcazou  <ebotcazou@adacore.com>
>
>         PR middle-end/65958
>         * gimplify.c (struct gimplify_ctx): Turn boolean fields into 1-bit
>         fields, add keep_stack and reorder them.
>         (gimplify_bind_expr): Save gimplify_ctxp->keep_stack on entry then
>         set it to false.  Do not insert a stack save/restore pair if it has
>         been set to true by the gimplification of the statements.
>         Restore it to the saved value on exit if it is still false.
>         (gimplify_vla_decl): Do not set gimplify_ctxp->save_stack here.
>         (gimplify_call_expr) <BUILT_IN_ALLOCA[_WITH_ALIGN]>: New case.  Set
>         either save_stack or keep_stack depending on CALL_ALLOCA_FOR_VAR_P.
>
>
> 2015-11-18  Eric Botcazou  <ebotcazou@adacore.com>
>
>         * gcc.dg/vla-24.c: New test.
>
> --
> Eric Botcazou

  reply	other threads:[~2015-11-18 10:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-18 10:07 Eric Botcazou
2015-11-18 10:25 ` Richard Biener [this message]
2015-11-18 11:14   ` Eric Botcazou
2015-11-18 13:39     ` Richard Biener
2015-11-18 14:28       ` Eric Botcazou
2015-11-18 15:22         ` Richard Biener
2015-11-18 15:35           ` 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=CAFiYyc2eRFafhB54BNcuGp+ZpAfZzRhvpg0+wU1F5qVxJ3eCXQ@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).