All throughout history, GCC has had a -fno-strict-overflow option.
Conversation
Replying to
supporting both this and -fwrapv is the sort of mental contortion only a compiler developer could love
3
14
and then throw in -ftrapv which never quite seemed to reach the level of best-effort trapping but was rather more of a halfhearted decision to trap when the moon was in a certain phase
1
3
It's fine with Clang in the trapping mode. I wouldn't use the GCC implementation in production.
By the way, in GCC, -ftrapv and -fsanitize=signed-integer-overflow -fsanitize-undefined-trap-on-error have different implementations broken in their own ways.



