Most popular C compilers support trapping on integer overflow (i.e.
https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#ind...), but it does have some overhead as it replaces the native arithmetic instruction with a call to a library function (i.e.
https://gcc.gnu.org/onlinedocs/gccint/Integer-library-routin...)