https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92331
Bug ID: 92331
Summary: ICE on incorrect code with VLA
Product: gcc
Version: 9.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: coillol at yandex dot ru
Target Milestone: ---
The following text triggers ICE in gcc (at least on 9.2.0 and trunk --
https://godbolt.org/z/WHnZCJ):
int foo();
int main() {
using X = int[foo()];
struct S { S() { X x; } } s;
}
Compiling it using gcc-9.2.0 with no additional options gives this stacktrace:
during RTL pass: expand
doublekill.cpp: In constructor ‘main()::S::S()’:
doublekill.cpp:4:22: internal compiler error: in expand_expr_real_1, at
expr.c:10012
4 | using X = int[foo()];
| ^
0x5c5d88 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
../.././gcc/expr.c:10012
0x8eb0ab store_expr(tree_node*, rtx_def*, int, bool, bool)
../.././gcc/expr.c:5674
0x8ec2b0 expand_assignment(tree_node*, tree_node*, bool)
../.././gcc/expr.c:5436
0x7ee5a8 expand_gimple_stmt_1
../.././gcc/cfgexpand.c:3752
0x7ee5a8 expand_gimple_stmt
../.././gcc/cfgexpand.c:3850
0x7f34bf expand_gimple_basic_block
../.././gcc/cfgexpand.c:5890
0x7f583e execute
../.././gcc/cfgexpand.c:6513