https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93806
--- Comment #6 from Alexander Cherepanov <ch3root at openwall dot com> --- I agree that every separate optimization here is quite natural. At the same time, the end result is quite unnatural. The following is a look at the situation from an outsider POV. -funsafe-math-optimizations makes floating-point values unpredictable and unstable. That's fine. And gcc is ready for this. For example, it doesn't propagate conditional equivalence for them (signed zeros would complicate it but -funsafe-math-optimizations enables -fno-signed-zeros). OTOH gcc assumes that integers are stable. And conditional equivalence propagation is fine for them. Nonsense results start to appear when the boundary between FPs and integers blurs. So an evident solution would be to stop replacing integers by FP computations. E.g., in this particular case, don't substitute FP equality in place of non-first instances of `a`, all instances of `a` should use the result of the same FP computation. This approach will also solve some problems with x87 (pr85957, pr93681) and with -mpc64 (pr93682). It will not make them conformant but at least it will fix some egregious issues.