https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120342
Bug ID: 120342
Summary: wrong code at -O{s,2,3} with "-fno-tree-ccp
-fno-tree-forwprop" on x86_64-linux-gnu
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: zhendong.su at inf dot ethz.ch
Target Milestone: ---
Compiler Explorer: https://godbolt.org/z/6Yfse1PMx
It appears to be quite long-latent and affects all versions.
[570] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/home/suz/suz-local/software/local/gcc-trunk/bin/../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 20250518 (experimental) (GCC)
[571] %
[571] % gcctk -O3 small.c
[572] %
[572] % gcctk -O3 -fno-tree-ccp -fno-tree-forwprop small.c
[573] % ./a.out
Aborted
[574] %
[574] % cat small.c
int main() {
int p = 0;
struct {
char q;
} *r = (void *)&p;
r->q = 1;
if (p != 1)
__builtin_abort();
return 0;
}