https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70489
Bug ID: 70489 Summary: ICE in cxx_eval_increment_expression initializing a VLA in a constexpr function Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- Current top of trunk (6.0) as well as 5.x both fail with an ICE on the following valid code. $ cat t.c && /build/gcc-trunk/gcc/xgcc -B /build/gcc-trunk/gcc -Wall -xc++ t.c constexpr int f (int m, int n) { char a [m][n] = { 1, 2, 3, 4 }; return 0; } constexpr int i = f (2, 2); t.c: In function ‘constexpr int f(int, int)’: t.c:3:10: warning: unused variable ‘a’ [-Wunused-variable] char a [m][n] = { 1, 2, 3, 4 }; ^ t.c: At global scope: t.c:7:21: in constexpr expansion of ‘f(2, 2)’ t.c:7:26: internal compiler error: in cxx_eval_increment_expression, at cp/constexpr.c:3001 constexpr int i = f (2, 2); ^ 0x106f3147 cxx_eval_increment_expression /src/gcc/trunk/gcc/cp/constexpr.c:3001 0x106f6daf cxx_eval_constant_expression /src/gcc/trunk/gcc/cp/constexpr.c:3789 0x106f63eb cxx_eval_constant_expression /src/gcc/trunk/gcc/cp/constexpr.c:3720 0x106f5b47 cxx_eval_constant_expression /src/gcc/trunk/gcc/cp/constexpr.c:3492 0x106f3a7f cxx_eval_statement_list /src/gcc/trunk/gcc/cp/constexpr.c:3152 0x106f6cff cxx_eval_constant_expression /src/gcc/trunk/gcc/cp/constexpr.c:3776 0x106f63eb cxx_eval_constant_expression /src/gcc/trunk/gcc/cp/constexpr.c:3720 0x106f63eb cxx_eval_constant_expression /src/gcc/trunk/gcc/cp/constexpr.c:3720 0x106f5b47 cxx_eval_constant_expression /src/gcc/trunk/gcc/cp/constexpr.c:3492 0x106f5b47 cxx_eval_constant_expression /src/gcc/trunk/gcc/cp/constexpr.c:3492 0x106f3a7f cxx_eval_statement_list /src/gcc/trunk/gcc/cp/constexpr.c:3152 0x106f6cff cxx_eval_constant_expression /src/gcc/trunk/gcc/cp/constexpr.c:3776 0x106f6d83 cxx_eval_constant_expression /src/gcc/trunk/gcc/cp/constexpr.c:3782 0x106eb17b cxx_eval_call_expression /src/gcc/trunk/gcc/cp/constexpr.c:1393 0x106f502b cxx_eval_constant_expression /src/gcc/trunk/gcc/cp/constexpr.c:3374 0x106f77fb cxx_eval_outermost_constant_expr /src/gcc/trunk/gcc/cp/constexpr.c:3939 0x106f80af cxx_constant_value(tree_node*, tree_node*) /src/gcc/trunk/gcc/cp/constexpr.c:4028 0x1046900b store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) /src/gcc/trunk/gcc/cp/typeck2.c:822 0x1037bc43 check_initializer /src/gcc/trunk/gcc/cp/decl.c:6155 0x1037f797 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) /src/gcc/trunk/gcc/cp/decl.c:6783 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions.