[cfe-commits] [scan-build][PATCH 1/1] Unreachable code checker : false positive in switch statements ?

David Blaikie dblaikie at gmail.com
Wed Feb 29 09:04:35 PST 2012


On Tue, Feb 28, 2012 at 11:11 PM, Ted Kremenek <kremenek at apple.com> wrote:
> On Feb 28, 2012, at 10:29 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
> Should we just change the way the CFG is built to include edges for
> default labels on covered switches all the time? That would fix the
> same bug (I'm on the fence about whether it is a bug, myself) in
> Clang's -Wunreachable-code.
>
>
> Hi David,
>
> Besides the technical solution I proposed in my other email, I thought I'd
> add one more thing.
>
> From a design perspective, I don't believe what you propose would even be
> the right balance.  All the other analyses in clang, the dataflow based
> warnings, the static analyzer, etc., are fine with the current CFG with
> respect to how 'default' labels are handled.  Should we really weaken the
> CFG, thus degrading the precision of all of these analyses, just to make
> this one warning easier to implement?

This was, basically, what I ended up asking about in a round-about-way
in my parenthetical at the end of my original email: should default
cases on covered switches be considered as a viable alternative when
it comes to things like uninitialized variables? Or, as I said, do
they fall into the, "not provably reachable or unreachable" middle
ground of all the other things like sizeof/macros/etc & it sounds like
you're suggesting they do - which I'm fine with.

- David




More information about the cfe-commits mailing list