https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127620
Bug ID: 127620
Summary: ICE in cp_parser_omp_loop_nest, at cp/parser.cc
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: s.kimura.h41104 at gmail dot com
Target Milestone: ---
Compiler Explorer: https://godbolt.org/z/6vjPPe31n
Reproducer:
```
void foo() {
#pragma omp taskloop
for (struct S {
S *s{};
void bar() {
for (;;)
;
}
})
}
```
Backtrace:
<source>: In member function 'void foo()::S::bar()':
<source>:6:19: internal compiler error: tree check: accessed elt 2 of
'tree_vec' with 1 elts in cp_parser_omp_loop_nest, at cp/parser.cc:50172
6 | for (;;)
| ^
0x2c5c488 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x2c510cb internal_error(char const*, ...)
???:0
0xa466df tree_vec_elt_check_failed(int, int, char const*, int, char const*)
???:0
0xdd9013 c_parse_file()
???:0
0xf6cb99 c_common_parse_file()
???:0
This ICE goes back to gcc-14:
https://godbolt.org/z/6sYqTWxnr