https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104884
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- The behavior is undefined so gcc decides the code is unreachable and optimizes it that way. Use -fwrapv if you want it to be defined code. Of use -fsanitize=undefined to detect the undefined behavior at runtime.