News for hackers. Stuff that matters.
Re:Solutions to Integer Overflow by mdadm on Saturday September 03, 2016 @03:12PM (#12420597)
>As an example compile this with optimisations (should work the same with signed integer overflow):

Interesting. Clang and GCC both produce a binary that gets terminated by SIGFPE under normal compilation, but using -O3, Clang's output will run correctly while GCC's output will still SIGFPE.

Re:Solutions to Integer Overflow by legulere on Saturday September 03, 2016 @03:54PM (#12420838)
Not that surprising for the unoptimized binary, the expression simply doesn't get folded and the division is executed on the processor. x86 processors trap when they do a division by zero. This is a totally correct execution with C, as division by zero is undefined behaviour. You would probably even expect that to happen.

I can't tell you though why the GCC binary even with optimisations outputs SIGFPE though, they probably don't optimize as much with undefined values.