https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70555
Bug ID: 70555 Summary: ICE in expand_expr_real_1 accessing a multi-dimensional VLA via lambda-capture 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: --- The following test case derived from g++.dg/cpp1y/vla7.C causes an ICE in todays's trunk of 6.0 as well as in 5.x and 4.9.3. $ cat t.c && /build/gcc-trunk/gcc/xgcc -B /build/gcc-trunk/gcc -S -Wall -Wextra -Wpedantic -xc++ t.c int f (int n) { int x[n][n]; [&x](int i) { x[0][i] = 0; }(5); } t.c: In function ‘int f(int)’: t.c:3:13: warning: ISO C++ forbids variable length array ‘x’ [-Wvla] int x[n][n]; ^ t.c:3:13: warning: ISO C++ forbids variable length array ‘x’ [-Wvla] t.c:8:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ t.c: In lambda function: t.c:5:15: warning: ‘<anonymous>’ is used uninitialized in this function [-Wuninitialized] [&x](int i) { ^ t.c:6:11: warning: ‘<anonymous>’ is used uninitialized in this function [-Wuninitialized] x[0][i] = 0; ~~~~~~^ t.c:5:15: internal compiler error: in expand_expr_real_1, at expr.c:9651 [&x](int i) { ^ 0x10a80e1f expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) /src/gcc/trunk/gcc/expr.c:9645 0x10a77f2f expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) /src/gcc/trunk/gcc/expr.c:7962 0x10a56cf7 expand_expr /src/gcc/trunk/gcc/expr.h:256 0x10a7939f expand_expr_real_2(separate_ops*, rtx_def*, machine_mode, expand_modifier) /src/gcc/trunk/gcc/expr.c:8181 0x1087a59b expand_gimple_stmt_1 /src/gcc/trunk/gcc/cfgexpand.c:3654 0x1087a8eb expand_gimple_stmt /src/gcc/trunk/gcc/cfgexpand.c:3714 0x1088403f expand_gimple_basic_block /src/gcc/trunk/gcc/cfgexpand.c:5720 0x10886267 execute /src/gcc/trunk/gcc/cfgexpand.c:6335 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.