This is the mail archive of the gcc-bugs@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]

[Bug c++/70588] SIGBUS on a VLA larger than SIZE_MAX / 2


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70588

--- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> ---
I agree that the SIZE_MAX/2 limit isn't very useful.   A lower limit would be
more useful (I proposed one on the order of tens of kilobytes to megabytes in
my patch for bug 69517).  Jason and I have been discussing making the limit
customizable somehow (see
https://gcc.gnu.org/ml/gcc-patches/2016-04/msg00368.html for some ideas --
suggestions for better solutions are welcome).

Other than that, while I also agree with the goal of keeping C++ VLAs close to
C, since overflowing the stack is the most serious shortcoming of the latter,
detecting and preventing that condition (as well as detecting excess
initializers in the G++ extension) by throwing an exception is an important
improvement that makes the feature safer to use.  It is in line with how
overflowing array bounds in the array new expression is handled.

(As an aside, since C doesn't have exceptions, trapping or aborting in case of
bound overflow might be worth considering as a stopgap solution.)

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