Hacker News new | ask | show | jobs
by capisce 5074 days ago
> ongoing debate about the exploitation of undefined behavior by C compilers for optimization

Can you provide some links to other examples of this?

2 comments

There was much gnawing of teeth when compilers started to take advantage of the “strict aliasing rule”: http://labs.qt.nokia.com/2011/06/10/type-punning-and-strict-...

Programmers might think that it is okay to use uninitialized variables as a source of additional entropy (xoring with the real source of entropy), but it isn't, because the compiler will treat the uninitialized access as undefined behavior and eliminate code altogether: http://kqueue.org/blog/2012/06/25/more-randomness-or-less/

This 3-part blog post by Chris Lattner has various examples: http://blog.llvm.org/2011/05/what-every-c-programmer-should-...