This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] 69517 - [5/6 regression] SEGV on a VLA with excess initializer elements


On 03/06/2016 08:38 PM, Martin Sebor wrote:
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.

Makes sense.

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.)

The bounds checking should share code with build_new_1.

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.

What deliberate decision? The old code checked for C++14 mode because the feature was part of the C++14 working paper. What's the rationale for C++11 as the cutoff?

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]