https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115927
Bug ID: 115927 Summary: wrong code at -O{2,3} with "-fno-tree-vrp" on x86_64-linux-gnu (nondeterministic behavior) 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: --- It appears to be a recent regression as it doesn't reproduce with 14.1 and earlier. Compiler Explorer: https://godbolt.org/z/76naEWj7b [582] % 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/15.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 15.0.0 20240714 (experimental) (GCC) [583] % [583] % gcctk -O2 small.c [584] % ./a.out 0 [585] % gcctk -O2 -fno-tree-vrp small.c [586] % ./a.out [587] % ./a.out [588] % ./a.out 0 [589] % ./a.out 0 [590] % cat small.c int printf(const char *, ...); int a, c, d; long b; char e; int main() { d = 4 ^ a; e = (~(b & 5) & (0 || d) << c) % 4; if (e > 0) printf("%d\n", a); return 0; }