[Bug c++/69509] [5/6 regression] infinite loop compiling a VLA in a recursive constexpr function

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

--- Comment #4 from Marek Polacek  ---
Author: mpolacek
Date: Fri Jan 29 09:25:14 2016
New Revision: 232969

URL: https://gcc.gnu.org/viewcvs?rev=232969=gcc=rev
Log:
PR c++/69509
PR c++/69516
* constexpr.c (cxx_eval_array_reference): Give the "array subscript
out of bound" error earlier.
* init.c (build_vec_init): Change NE_EXPR into GT_EXPR.  Update the
commentary.

* g++.dg/ext/constexpr-vla2.C: New test.
* g++.dg/ext/constexpr-vla3.C: New test.
* g++.dg/ubsan/vla-1.C: Remove dg-shouldfail.

Added:
trunk/gcc/testsuite/g++.dg/ext/constexpr-vla2.C
trunk/gcc/testsuite/g++.dg/ext/constexpr-vla3.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/constexpr.c
trunk/gcc/cp/init.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/ubsan/vla-1.C

[Bug c++/69509] [5/6 regression] infinite loop compiling a VLA in a recursive constexpr function

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

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Marek Polacek  ---
Fixed for GCC 6.

[Bug c++/69509] [5/6 regression] infinite loop compiling a VLA in a recursive constexpr function

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

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org
   Target Milestone|--- |5.4

--- Comment #3 from Marek Polacek  ---
I see the problem here too.

[Bug c++/69509] [5/6 regression] infinite loop compiling a VLA in a recursive constexpr function

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

Martin Sebor  changed:

   What|Removed |Added

   Keywords||ice-on-valid-code
Summary|infinite loop compiling a   |[5/6 regression] infinite
   |VLA in a recursive  |loop compiling a VLA in a
   |constexpr function  |recursive constexpr
   ||function
  Known to fail||5.3.0, 6.0

--- Comment #2 from Martin Sebor  ---
Marking this a 5/6 regression since ICE 4.9.3 rejects the code with the error
below because it doesn't allow contexpr functions to have more than one
(return) statement.

t.c: In function ‘constexpr int foo(int)’:
t.c:8:1: error: body of constexpr function ‘constexpr int foo(int)’ not a
return-statement
 }
 ^
t.c: At global scope:
t.c:10:25: error: ‘constexpr int foo(int)’ called in a constant expression
 constexpr int i = foo (3);
 ^