News for hackers. Stuff that matters.
Re:Proposal for a Friendly Dialect of C by cousin_it on Wednesday August 27, 2014 @03:10PM (#8234123)
Sometime ago I came up with a simpler proposal: emit a warning if UB exploitation makes a line of code unreachable. That refers to actual lines in the source, not lines after macroexpansion and inlining. Most "gotcha" examples with UB that I've seen so far contain unreachable lines in the source, while most legitimate examples of UB-based optimization contain unreachable lines only after macroexpansion and inlining.

Such a warning would be useful in any case, because in legitimate cases it would tell the programmer that some lines can be safely deleted, which is always good to know.

Re:Proposal for a Friendly Dialect of C by regehr on Wednesday August 27, 2014 @03:48PM (#8234350)
The linked articles by Chris Lattner explain why this is very difficult.

http://blog.llvm.org/2011/05/what-every-c-programmer-should-...

Re:Proposal for a Friendly Dialect of C by cousin_it on Wednesday August 27, 2014 @04:28PM (#8234561)
Is it true that undesirable UB exploitation often happens after macroexpansion and inlining, and doesn't make any actual source lines unreachable? Are there any simple examples of that?
Re:Proposal for a Friendly Dialect of C by regehr on Wednesday August 27, 2014 @04:41PM (#8234620)
Re:Proposal for a Friendly Dialect of C by cousin_it on Wednesday August 27, 2014 @04:55PM (#8234673)
Yeah. Thanks!