https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121656
Bug ID: 121656
Summary: wrong code at -O{1,2,3} 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/nc4arz3Ts
Note:
- works: 15.2 and earlier
- fails: trunk
[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 20250824 (experimental) (GCC)
[571] %
[571] % gcctk -O1 small.c
[572] % ./a.out
1073741823
[573] % cat small.c
int printf(const char *, ...);
int a;
int main() {
int b = 0;
if (a >= 0)
b += 3;
printf("%d\n", b);
return 0;
}