https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123778
Bug ID: 123778
Summary: ICE at -O2/O3 with PGO on x86_64_linux-gnu:
verify_gimple failed
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: xintong.zhou1 at uwaterloo dot ca
Target Milestone: ---
Created attachment 63462
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63462&action=edit
The profile for PGO.
The ICE happens when using the attached profile to compile small.c with PGO.
To reproduce the ICE, put the attached profile (a-small.gcda) in the same
directory as small.c and compile as follows. The profile can also be obtained
by compiling the source code with `-fprofile-generate` and running the binary.
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/home/x27zhou/compiler-nightly/install/gcc/libexec/gcc/x86_64-pc-linux-gnu/16.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/x27zhou/compiler-nightly/src/gcc/configure
--enable-checking=yes --disable-bootstrap --disable-multilib
--enable-languages=c,c++ --prefix=/home/x27zhou/compiler-nightly/install/gcc
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.0.1 20260122 (experimental) (GCC)
$
$
$ cat small.c
int a, c, f = 2;
int b(char g) {
char d[] = {4, g, 0};
char *e = d;
while (*e)
e++;
a = e - d;
return a;
}
static unsigned long(i)(unsigned long, int) {}
short **j;
int k() {
int *l = &f;
for (;;)
if ((b(*l) & i(c, 0)) <= **j)
return 0;
}
void main() { k(); }
$
$
$ gcc-trunk -O3 -fprofile-use small.c
small.c: In function ‘main’:
small.c:18:6: error: type mismatch in ‘cond_expr’
18 | void main() { k(); }
| ^~~~
long int
char[3] *
char[3] *
_8 = _33 ? 2B : 1B;
during GIMPLE pass: vrp
small.c:18:6: internal compiler error: verify_gimple failed
0x23ac1df internal_error(char const*, ...)
/home/x27zhou/compiler-nightly/src/gcc/gcc/diagnostic-global-context.cc:787
0x1086010 verify_gimple_in_cfg(function*, bool, bool)
/home/x27zhou/compiler-nightly/src/gcc/gcc/tree-cfg.cc:5599
0xee25bf execute_function_todo(function*, void*)
/home/x27zhou/compiler-nightly/src/gcc/gcc/passes.cc:2100
0xee0ed1 execute_todo(unsigned int)
/home/x27zhou/compiler-nightly/src/gcc/gcc/passes.cc:2152
/home/x27zhou/compiler-nightly/install/gcc/libexec/gcc/x86_64-pc-linux-gnu/16.0.1/cc1
-quiet -imultiarch x86_64-linux-gnu small.c -quiet -dumpdir a- -dumpbase
small.c -dumpbase-ext .c -mtune=generic -march=x86-64 -O3 -fprofile-use -o
/tmp/ccUFMdbb.s
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.