public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: Gcc Patch List <gcc-patches@gcc.gnu.org>,
	Jason Merrill <jason@redhat.com>
Subject: PING #2 [PATCH] 69517 - [5/6 regression] SEGV on a VLA with excess initializer elements
Date: Mon, 21 Mar 2016 22:10:00 -0000	[thread overview]
Message-ID: <56F06E4D.3060103@gmail.com> (raw)
In-Reply-To: <56E72C94.5080605@gmail.com>

I'm looking for a review of the patch below.  I noticed a piece
of commented out code in there.  Please assume that I will remove
it before the final commit.

As a heads up, I'm traveling this Thursday through Sunday and
won't have access to email to answer questions or address
comments until next Monday.

Martin

On 03/14/2016 03:26 PM, Martin Sebor wrote:
> Ping:
>    https://gcc.gnu.org/ml/gcc-patches/2016-03/msg00441.html
>
> On 03/06/2016 06:38 PM, Martin Sebor wrote:
>> GCC 4.9 had added support for C++ VLAs as specified in WG21
>> document N3639 expected to be included in C++ 14.  However,
>> WG21 ultimately decided not to include N3639 in C++ 14 and
>> the G++ support was partially removed in 5.1.  Unfortunately,
>> the removal rendered some safe albeit erroneous G++ 4.9 code
>> undefined.  This patch restores the well-defined behavior of
>> such code by having it throw an exception in response to
>> the erroneous conditions.
>>
>> While testing the patch I found a number of other problems in
>> the G++ support for VLAs, including PR c++/70019 - VLA size
>> overflow not detected, which was never implemented (not even
>> in 4.9).  Since this is closely related to the regression
>> discussed in 69517 the patch also provides that support.
>>
>> There are a few additional points to note about the patch:
>>
>> 1) It restores the std::bad_array_length exception from N3639,
>>     even though the class isn't specified by the C++ standard.
>>     At first I thought that introducing a different (private)
>>     type would be more appropriate, but in the end couldn't come
>>     up with a good argument for not keeping the same type.  Using
>>     the same type also allows programs that rely on the exception
>>     and that were built with GCC 4.9 to be ported to GCC 6 without
>>     change.
>>
>> 2) It hardwires a rather arbitrarily restrictive limit of 64 KB
>>     on the size of the biggest C++ VLA.  (This could stand to be
>>     improved and made more intelligent, and perhaps integrated
>>     with stack  checking via -fstack-limit, after the GCC 6
>>     release.)
>>
>> 3) By throwing an exception for erroneous VLAs the patch largely
>>     defeats the VLA Sanitizer.  The sanitizer is still useful in
>>     C++ 98 mode where the N3639 VLA runtime checking is disabled,
>>     and when exceptions are disabled via -fno-exceptions.
>>     Disabling  the VLA checking in C++ 98 mode doesn't seem like
>>     a useful feature, but I didn't feel like reverting what was
>>     a deliberate decision.
>>
>> Martin
>

  reply	other threads:[~2016-03-21 21:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-07  1:38 Martin Sebor
2016-03-14 21:26 ` Martin Sebor
2016-03-21 22:10   ` Martin Sebor [this message]
2016-03-23 18:34 ` Jason Merrill
2016-03-23 22:50   ` Martin Sebor
2016-03-24 16:24     ` Jason Merrill
2016-04-01 23:02       ` Martin Sebor
2016-04-04 23:35         ` Jason Merrill
2016-04-08  0:05           ` Martin Sebor
2016-04-10 23:14             ` Martin Sebor
2016-04-12 15:43               ` Jason Merrill
2016-04-12 17:37                 ` Martin Sebor
2016-04-12 18:17               ` Jason Merrill
2016-04-13 18:37                 ` Martin Sebor
2016-04-13 19:26                   ` Jason Merrill
2016-04-14  2:35                   ` H.J. Lu
2016-04-14 15:32                     ` Martin Sebor
2016-04-14 10:40                   ` Andreas Schwab
2016-04-14 15:26                     ` Martin Sebor
2016-04-15  7:11                       ` Christophe Lyon
2016-04-15 12:31                       ` Jakub Jelinek
2016-04-15 14:33                         ` Martin Sebor

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=56F06E4D.3060103@gmail.com \
    --to=msebor@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    /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).