https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120236
Bug ID: 120236
Summary: wrong code at -O{s,2,3} with "-fno-tree-fre -fipa-pta"
on x86_64-linux-gnu
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ipa
Assignee: unassigned at gcc dot gnu.org
Reporter: zhendong.su at inf dot ethz.ch
Target Milestone: ---
Compiler Explorer: https://godbolt.org/z/jjrdsPYTn
This appears to affect all versions, so perhaps a known issue?
[507] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/16.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 16.0.0 20250512 (experimental) (GCC)
[508] %
[508] % gcctk -O3 small.c; ./a.out
[509] %
[509] % gcctk -O3 -fno-tree-fre -fipa-pta small.c
[510] % ./a.out
Aborted
[511] %
[511] % cat small.c
int a, b, *c = &b;
int main() {
while (a) {
int ***d;
*d = &c;
a = ***d;
if (b)
__builtin_abort();
}
*c = 1;
if (!b)
__builtin_abort();
return 0;
}