https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123729
Bug ID: 123729
Summary: [13/14/15/16 Regression] ICE in verify_ssa:
SSA_NAME_OCCURS_IN_ABNORMAL_PHI should be set during
GIMPLE pass: vect
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jirehguo at tju dot edu.cn
Target Milestone: ---
Compiler Explorer: https://godbolt.org/z/rvhzdh68a
The following c++ code crash gcc trunk with -O2 flag.
Goes back to 13.3 with checking.
Code:
```cpp
#include <csetjmp>
#include <iostream>
template <typename T> struct A { using type = int; };
template <typename F, typename... G> struct B {};
template <typename F> struct B<F> { using type = F; };
struct {
template <typename... F,
typename Overload = typename B<typename A<F>::type...>::type>
int operator()(F...) {
int iArrFld_0_0;
for (int i = 7; i < 28; ++i)
;
int i1 = 3;
try {
for (int i = 7; i < 28; ++i) {
for (int j = 0; j < 7; ++j)
if (iArrFld_0_0 == 0) {
for (int k = 0; k < 20000; ++k)
std::cout << "Hello, world!" << std::endl;
}
jmp_buf env2;
for (int i2 = 16; i2 < 350; ++i2)
for (int j2 = 1; j2 < 75; ++j2)
for (int k2 = 0; k2 < 16; ++k2) {
int temp2 = i2 + j2 + k2;
int mod2 = temp2 % 8;
{
setjmp(env2) == 0;
;
}
}
}
} catch (const std::exception &e) {
}
auto lambda = [](int x) {
return [x](int y) {
int z = 0;
if (y > 0)
z = 1;
return z + x;
};
};
for (int i = 0; i < 1000; ++i) {
int m = 0;
auto f = lambda(i);
for (int j = 0; j < 100; ++j)
m += f(j);
i1 += m;
}
std::cout << "Final value of i1: " << i1 << std::endl;
}
} a;
int main() {
auto f = a([] {});
}
```
Stack dump:
```
<source>: In instantiation of 'int<unnamed struct>::operator()(F ...) [with F =
{main()::<lambda()>}; Overload = int]':
required from here
<source>:54:13:
54 | auto f = a([] {});
| ~^~~~~~~
<source>:51:3: warning: no return statement in function returning non-void
[-Wreturn-type]
51 | }
| ^
<source>: In function 'int<unnamed struct>::operator()(F ...) [with F =
{main()::<lambda()>}; Overload = int]':
<source>:9:7: error: SSA_NAME_OCCURS_IN_ABNORMAL_PHI should be set
9 | int operator()(F...) {
| ^~~~~~~~
for SSA_NAME: _103 in statement:
i1_34(ab) = PHI <_103(21), i1_39(ab)(5), i1_9(ab)(9), i1_39(ab)(4), _103(22),
_103(23), i1_39(ab)(28), i1_39(ab)(29)>
PHI argument
_103
for PHI node
i1_34(ab) = PHI <_103(21), i1_39(ab)(5), i1_9(ab)(9), i1_39(ab)(4), _103(22),
_103(23), i1_39(ab)(28), i1_39(ab)(29)>
during GIMPLE pass: vect
<source>:9:7: internal compiler error: verify_ssa failed
0x294d958 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x294271b internal_error(char const*, ...)
???:0
0x17e773a verify_ssa(bool, bool)
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
```