https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128426
Bug ID: 128426
Summary: ICE: verify_ssa failed (PHI argument on abnormal edge
is not SSA_NAME) during vrp at -O2/-Os
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: lyfanyang at smail dot nju.edu.cn
Target Milestone: ---
Created attachment 66082
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=66082&action=edit
Sample in description
The following valid C code fails SSA verification during vrp at -O2, -O3 and
-Os on a compiler configured with --enable-checking=yes. -O1 and -Og are fine,
and so is -fno-tree-vrp.
$ cat ice.c
int a;
static void c (int);
void
d (void)
{
int e = 0;
void *f[] = { &&g, &&h, &&i };
goto *f[a];
h:
goto k;
i:
e = a;
goto l;
k:
c (e);
goto m;
g:
l:
if (e)
goto m;
goto h;
m:;
}
static void
c (int p)
{
if (p)
d ();
}
$ gcc -O2 -c ice.c
ice.c: In function 'd':
ice.c:5:1: error: PHI argument on abnormal edge is not SSA_NAME
5 | d (void)
| ^
PHI argument
0
for PHI node
e_3(ab) = PHI <0(2)>
during GIMPLE pass: vrp
ice.c:5:1: internal compiler error: verify_ssa failed
0x2a8a526 internal_error(char const*, ...)
gcc/diagnostic-global-context.cc:787
0x16cb07b verify_ssa(bool, bool)
gcc/tree-ssa.cc:1226
0x12a6dfc execute_function_todo
gcc/passes.cc:2107
0x12a76ce execute_todo
gcc/passes.cc:2152
Versions tested at -O2 and -Os:
9.4.0 (--enable-checking=release, with -fchecking at -O2) no error
16.2.0 (--enable-checking=release, with -fchecking) no error
17.0.0 20261018 (--enable-checking=yes) ICE
17.0.0 20261101 (--enable-checking=yes) ICE
With -fno-checking trunk compiles it without an error. Linked with a main that
calls d (), that -O2 -fno-checking build runs correctly, and an -O0 build is
clean under -fsanitize=address,undefined.
Target: x86_64-pc-linux-gnu
Configured with: configure --enable-languages=c,c++ --disable-bootstrap
--disable-multilib --disable-nls --enable-checking=yes