This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Resurrecting -Wunreachable

On 05/07/2014 02:43 PM, Richard Biener wrote:

The more challenging issue with early GIMPLE is that loops have already been
lowered to gotos, so adopting the syntax-based Java reachability rules is
impossible.  Oh dear.

Perfect is the enemy of the good (no false positives and no false
negatives).  I don't think you can get all you want starting at GIMPLE.
And the "earlier" you start the more you need to implement a whole compiler.

We already had an unreachable code warning at a later stage in the compiler. Its reporting was so confusing that it head to be removed. I don't think this approach works.

And you have of course to precisely define what you consider
"unreachable" (considering a global const bool debug = true/false; and
if (debug) guarded code - compared to using the preprocessor).

I plan to follow the Java rules, with necessary adjustments due to language differences:


They are based on syntax (except for the infinite loop case), so they are much more predictable from a developer perspective.

There are other warnings which benefit greatly from information collected during optimization, but unreachable code doesn't.

Florian Weimer / Red Hat Product Security Team

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]