https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124531
Bug ID: 124531
Summary: [15/16 regression] ICE on char[] with large
initializer list
Product: gcc
Version: 15.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: peter0x44 at disroot dot org
Target Milestone: ---
int main() {
new char[]{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
}
Compile this and observe:
during RTL pass: expand
test.c: In function ‘int main()’:
test.c:15:5: internal compiler error: in expand_expr_real_2, at expr.cc:9854
15 | };
| ^
0x26ef811 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
???:0
0x2749918 internal_error(char const*, ...)
???:0
0x715613 fancy_abort(char const*, int, char const*)
???:0
0xbd8d7a expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
???:0
0xbed021 store_expr(tree_node*, rtx_def*, int, bool, bool)
???:0
With -O2 the error is instead:
In function 'int main()':
<source>:16:1: error: incorrect sharing of tree nodes
16 | }
| ^
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ..., 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
# .MEM_17 = VDEF <.MEM_14>
MEM[(char *)_8 + 1B] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ..., 0, 0, 0, 0, 0, 0, 0,
0, 0, 0;
during GIMPLE pass: fre
<source>:16:1: internal compiler error: verify_gimple failed
0x2965fc8 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x295ac0b internal_error(char const*, ...)
???:0
0x15adf4e verify_gimple_in_cfg(function*, bool, bool)
???:0