News for hackers. Stuff that matters.
Re:Defining the Undefinedness of C (2015) [pdf] by bbatha on Wednesday July 26, 2017 @12:37PM (#14857751)
> Division by zero is UB. This lets the compiler assume it does not happen and thus it won't have to emit additional instructions to check for it.

Right, but it doesn't then follow that it can then "optimize" out the rest of your program. It could allow it to compile to what's expected and rely on the platform to handle corrupt program state. Which is what happens if you trigger run time UB anyway. It can also be implementation defined, because virtually all modern platforms trap on division by zero which would lead to more predictable optimizer behavior.

There are no comments on this comment yet.