https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109393
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Note sometimes -fwrapv will optimize things because it can assume that overflow is defined as wrapping and this is one case that is true. Yes it sounds counter intuitive but it is true. Even re-association happens more with -fwrapv :).