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
I seemed to notice that it does more and more, which is a good thing, but is not what you want in a part of the compiler that you use for release builds. I would avoid, personally. May depend on one's context.
2
1
yeah, you definitely cannot just turn on a feature like this that has feature creep. but you can turn on parts of it, esp in a code base like Android where the compiler is effectively part of the system being deployed.
1
2
Keep in mind that Android uses Clang for both the kernel and userspace though. It never used UBSan with GCC.



