3 ms·
Compiling with -ftrapv will cause your program to trap on signed overflow/underflow, so when you run it in a debugger you can immediately see where and why the
by ndiddy 2y ago
Compiling with -ftrapv will cause your program to trap on signed overflow/underflow, so when you run it in a debugger you can immediately see where and why the overflow/underflow occurred.
- AlotOfReading 2y agoIt's worth mentioning that GCC's ftrapv has been unreliable and partially broken for 20+ years at this point. It's recommended that you use the fsanitize traps instead, and there's an open ticket to switch the ftrapv implementation over to using it under the hood: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101521 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101521
- ndiddy 2y agoThanks, I hadn't heard of that.