https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126681
Bug ID: 126681
Summary: internal compiler error: in operator[], at vec.h:911
since 7.1
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: mario.rodriguezb1 at um dot es
Target Milestone: ---
The following C code triggers a segmentation fault and an internal compiler
error (ICE) in GCC:
```
int __RTL (startwith ("rtl-dfinit")) times_two (int i)
{
(function "times_two"
(insn-chain
(block -1) ;; block 1
) ;; insn-chain
) ;; function "times_two"
}
```
Stacktrace:
```
<source>:11:1: internal compiler error: in operator[], at vec.h:911
11 | }
| ^
0x27fe448 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x27f308b internal_error(char const*, ...)
???:0
0xa3aa9a fancy_abort(char const*, int, char const*)
???:0
0x11541c3 function_reader::parse_insn_chain()
???:0
0x1156c57 function_reader::parse_function()
???:0
0x2682ccf md_reader::handle_file()
???:0
0x2682fa5 md_reader::read_file_fragment(char const*, int, int)
???:0
0x1155af2 read_rtl_function_body_from_file_range(unsigned long, unsigned long)
???:0
0xb0e620 c_parse_file()
???:0
0xb93f69 c_common_parse_file()
???:0
```
To reproduce quickly:
https://godbolt.org/z/dKGErxzW1