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?
Does this example help?
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.