3 ms·
GCC 4.9 does have `-fsanitize=signed-integer-overflow`, and it generates pretty good code for that toy function: f(int, int): mov eax, edi
by pbsd 12y ago
GCC 4.9 does have `-fsanitize=signed-integer-overflow`, and it generates pretty good code for that toy function:
f(int, int):
mov eax, edi
add eax, esi
jo .L8
ret
.L8:
...
- Marat_Dukhan 12y agoOlder gcc versions have `-ftrapv` option, which checks overflow for signed addition, subtraction, and multiplication. However, the implementation calls libgcc functions to do the checks, resulting in non-negligible overhead.