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 13:39:00 -0000 [thread overview]
Message-ID: <CAFiYyc3KutSELxKYaPOysjsTs0u7aiAizGDP9O6FHLTCuM_jJw@mail.gmail.com> (raw)
In-Reply-To: <1948174.ZHELUNJJpu@polaris>
On Wed, Nov 18, 2015 at 12:12 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> Ok. I wonder if we document GCCs VLA implementation somewhere so we can add
>> a note on the interaction with alloca.
>
> I found this in 10.7.2 Blocks:
>
> "Variable-length arrays (VLAs) complicate this process, as their size
> often refers to variables initialized earlier in the block. To handle
> this, we currently split the block at that point, and move the VLA into
> a new, inner `BIND_EXPR'. This strategy may change in the future."
>
> which sounds totally obsolete to me. Proposed change:
Looks good to me. I also found the Arrays of Variable Length section
in extend.texi which also refers to alloca as doing the same. We may
want to add a note there that you should not mix both and that only
VLAs (when not mixed with alloca) are freed at scope boundary.
Richard.
> Index: doc/generic.texi
> ===================================================================
> --- doc/generic.texi (revision 230453)
> +++ doc/generic.texi (working copy)
> @@ -1950,11 +1950,15 @@ this initialization replaces the @code{D
> will never require cleanups. The scope of these variables is just the
> body
>
> -Variable-length arrays (VLAs) complicate this process, as their
> -size often refers to variables initialized earlier in the block.
> -To handle this, we currently split the block at that point, and
> -move the VLA into a new, inner @code{BIND_EXPR}. This strategy
> -may change in the future.
> +Variable-length arrays (VLAs) complicate this process, as their size
> +often refers to variables initialized earlier in the block and their
> +initialization involves an explicit stack allocation. To handle this,
> +we add an indirection and replace them with a pointer to stack space
> +allocated by means of @code{alloca}. In most cases, we also arrange
> +for this space to be reclaimed when the enclosing @code{BIND_EXPR} is
> +exited, the exception to this being when there is an explicit call to
> +@code{alloca} in the source code, in which case the stack is left
> +depressed on exit of the @code{BIND_EXPR}.
>
> A C++ program will usually contain more @code{BIND_EXPR}s than
> there are syntactic blocks in the source code, since several C++
>
>
> --
> Eric Botcazou
next prev parent reply other threads:[~2015-11-18 13:39 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
2015-11-18 11:14 ` Eric Botcazou
2015-11-18 13:39 ` Richard Biener [this message]
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=CAFiYyc3KutSELxKYaPOysjsTs0u7aiAizGDP9O6FHLTCuM_jJw@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).