https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118758
Bug ID: 118758 Summary: [15 regression] ok code with -O2, but wrong code with -O3 Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: dcb314 at hotmail dot com Target Milestone: --- Created attachment 60383 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60383&action=edit C source code For the attached C code, with recent gcc: foundBugs $ rm -f ./a.out ; ~/gcc/results/bin/gcc -w -O2 bug1086.c && ./a.out checksum = E0BB38EE foundBugs $ rm -f ./a.out ; ~/gcc/results/bin/gcc -w -O3 bug1086.c && ./a.out checksum = 3489BDAF foundBugs $ rm -f ./a.out ; ~/gcc/results/bin/gcc -w -O3 -fno-strict-aliasing bug1086.c && ./a.out checksum = 3489BDAF foundBugs $ rm -f ./a.out ; ~/gcc/results/bin/gcc -w -O3 -fno-strict-aliasing -fno-loop-interchange bug1086.c && ./a.out checksum = 3489BDAF foundBugs $ For stock gcc 14.2.0: foundBugs $ rm -f ./a.out ; ~/gcc/results.14.2.0/bin/gcc -w -O2 bug1086.c && ./a.out checksum = E0BB38EE foundBugs $ rm -f ./a.out ; ~/gcc/results.14.2.0/bin/gcc -w -O3 bug1086.c && ./a.out checksum = E0BB38EE foundBugs $ So this looks like a 15 regression. For the earliest gcc trunk I have: foundBugs $ rm -f ./a.out ; ~/gcc/results.20250107.asan.ubsan/bin/gcc -w -O2 bug1086.c && ./a.out checksum = E0BB38EE foundBugs $ rm -f ./a.out ; ~/gcc/results.20250107.asan.ubsan/bin/gcc -w -O3 bug1086.c && ./a.out checksum = 3489BDAF foundBugs $ so it looks like the bug appears sometime before g:aa688dd6302fd9fd