[Bug c++/69517] [5/6 regression] SEGV on a VLA with excess initializer elements

2016-04-14 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69517

Martin Sebor  changed:

   What|Removed |Added

Summary|[5 regression] SEGV on a|[5/6 regression] SEGV on a
   |VLA with excess initializer |VLA with excess initializer
   |elements|elements

--- Comment #11 from Martin Sebor  ---
Restoring 6 regression since the fix was reverted due to bug 70652.

[Bug c++/69517] [5/6 regression] SEGV on a VLA with excess initializer elements

2016-04-13 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69517

--- Comment #9 from Martin Sebor  ---
Author: msebor
Date: Wed Apr 13 23:26:41 2016
New Revision: 234966

URL: https://gcc.gnu.org/viewcvs?rev=234966&root=gcc&view=rev
Log:
PR c++/69517 - [5/6 regression] SEGV on a VLA with excess initializer elements
PR c++/70019 - VLA size overflow not detected
PR c++/70588 - SIGBUS on a VLA larger than SIZE_MAX / 2

gcc/testsuite/ChangeLog:
2016-04-13  Martin Sebor  

PR c++/69517
PR c++/70019
PR c++/70588
* c-c++-common/ubsan/vla-1.c (main): Catch exceptions.
* g++.dg/cpp1y/vla11.C: New test.
* g++.dg/cpp1y/vla12.C: New test.
* g++.dg/cpp1y/vla13.C: New test.
* g++.dg/cpp1y/vla14.C: New test.
* g++.dg/cpp1y/vla3.C: Restore deleted test.
* gcc/testsuite/g++.dg/init/array24.C: Fully brace VLA initializer.
* g++.dg/ubsan/vla-1.C: Disable exceptions.

gcc/cp/ChangeLog:
2016-04-13  Martin Sebor  

PR c++/69517
PR c++/70019
PR c++/70588
* cp-tree.h (throw_bad_array_length, build_vla_check): Declare new
functions.
* decl.c (check_initializer, cp_finish_decl): Call them.
(reshape_init_r): Reject incompletely braced intializer-lists
for VLAs.
* init.c (throw_bad_array_length, build_vla_check)
(build_vla_size_check, build_vla_init_check): Define new functions.
* typeck2.c (split_nonconstant_init_1): Use variably_modified_type_p()
to detect a VLA.
(store_init_value): Same.

gcc/doc/ChangeLog:
2016-04-13  Martin Sebor  

PR c++/69517
PR c++/70019
PR c++/70588
* extend.texi (Variable Length): Document C++ specifics.

libstdc++-v3/ChangeLog:
2016-04-13  Martin Sebor  

PR c++/69517
* testsuite/25_algorithms/rotate/moveable2.cc: Make sure VLA
   upper bound is positive.

Added:
trunk/gcc/testsuite/g++.dg/cpp1y/vla11.C
trunk/gcc/testsuite/g++.dg/cpp1y/vla12.C
trunk/gcc/testsuite/g++.dg/cpp1y/vla13.C
trunk/gcc/testsuite/g++.dg/cpp1y/vla14.C
trunk/gcc/testsuite/g++.dg/cpp1y/vla3.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/decl.c
trunk/gcc/cp/init.c
trunk/gcc/cp/typeck2.c
trunk/gcc/doc/extend.texi
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/c-c++-common/ubsan/vla-1.c
trunk/gcc/testsuite/g++.dg/init/array24.C
trunk/gcc/testsuite/g++.dg/ubsan/vla-1.C
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/testsuite/25_algorithms/rotate/moveable2.cc

[Bug c++/69517] [5/6 regression] SEGV on a VLA with excess initializer elements

2016-03-07 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69517

--- Comment #8 from Martin Sebor  ---
Patch posted for review:
https://gcc.gnu.org/ml/gcc-patches/2016-03/msg00441.html

[Bug c++/69517] [5/6 regression] SEGV on a VLA with excess initializer elements

2016-03-01 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69517

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2

[Bug c++/69517] [5/6 regression] SEGV on a VLA with excess initializer elements

2016-02-26 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69517

Martin Sebor  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
gnu.org
  Known to fail||5.3.0, 6.0

--- Comment #7 from Martin Sebor  ---
I'll look into this.

[Bug c++/69517] [5/6 regression] SEGV on a VLA with excess initializer elements

2016-01-29 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69517

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-01-29
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #6 from Marek Polacek  ---
Martin is planning some changes, thus confirmed.

[Bug c++/69517] [5/6 regression] SEGV on a VLA with excess initializer elements

2016-01-28 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69517

--- Comment #5 from Jason Merrill  ---
By the way, it was removed in r219359.

[Bug c++/69517] [5/6 regression] SEGV on a VLA with excess initializer elements

2016-01-28 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69517

--- Comment #4 from Jason Merrill  ---
(In reply to Martin Sebor from comment #3)
> Just to clarify: it's the program that crashes, not GCC (so removing the
> ice-on-invalid-code keyword).
> 
> But I also think that rejecting or at least loudly diagnosing the code would
> be preferable to letting it run off the rails.  We have tentatively agreed
> on this approach in a separate thread
> (https://gcc.gnu.org/ml/gcc-patches/2016-01/msg02167.html) so someone just
> needs to put together a patch.  I'll see if I can find the time to do it if
> no one beats me to it.

Thanks.

> With that said, I wonder if restoring the exception that 4.9.3 would be
> feasible.  It seems like the ideal solution, in line with the array new
> expression.  Jason. were there problems with it that the exception throwing
> code had to be removed?

The only issue was that the exception class was removed from the working paper,
so it isn't part of C++14.  I'm open to restoring the throwing code, but we
should probably use a different exception type, either bad_array_new_length or
an extension.

[Bug c++/69517] [5/6 regression] SEGV on a VLA with excess initializer elements

2016-01-28 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69517

Martin Sebor  changed:

   What|Removed |Added

   Keywords|ice-on-invalid-code |

--- Comment #3 from Martin Sebor  ---
Just to clarify: it's the program that crashes, not GCC (so removing the
ice-on-invalid-code keyword).

But I also think that rejecting or at least loudly diagnosing the code would be
preferable to letting it run off the rails.  We have tentatively agreed on this
approach in a separate thread
(https://gcc.gnu.org/ml/gcc-patches/2016-01/msg02167.html) so someone just
needs to put together a patch.  I'll see if I can find the time to do it if no
one beats me to it.

With that said, I wonder if restoring the exception that 4.9.3 would be
feasible.  It seems like the ideal solution, in line with the array new
expression.  Jason. were there problems with it that the exception throwing
code had to be removed?

[Bug c++/69517] [5/6 regression] SEGV on a VLA with excess initializer elements

2016-01-28 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69517

Richard Biener  changed:

   What|Removed |Added

   Keywords||accepts-invalid,
   ||ice-on-invalid-code
   Target Milestone|--- |5.4

--- Comment #2 from Richard Biener  ---
Well, we shouldn't ICE here but reject the program instead?

[Bug c++/69517] [5/6 regression] SEGV on a VLA with excess initializer elements

2016-01-27 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69517

Jason Merrill  changed:

   What|Removed |Added

 CC||jason at gcc dot gnu.org

--- Comment #1 from Jason Merrill  ---
In 4.9.3 we implemented the proposal for arrays of runtime bound that was
pulled out of C++14, and so it was pulled out of the compiler as well.  So now
excess initializers are undefined behavior.  I don't think this is a bug.