This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -Wuninitialized issues
On Wed, 2005-11-02 at 19:04 -0500, Kaveh R. Ghazi wrote:
> > I would suggest you look at our testsuite and our PR database and
> > see how many PRs we've got about false-positive warnings. Achieving
> > consistency will merely increase the false-positives and as a result
> > make the warning less useful IMHO.
>
> I looked at meta-bug 24639, it refers to several other PRs. Most of
> the complaints about false positives are either due to inlining or
> those involving the (in)famous conditional init and same conditional
> for use. There are a couple of complaints about too few i.e. missing
> warnings. And comment #4 in PR 20644 supports my position that
> warnings should be unaffected by optimization. So does Mark's posting
> here: http://gcc.gnu.org/ml/gcc/2005-11/msg00048.html
That comment reflects the opinions of some developers, but certainly
not all. I'll also suggest you look at how -Wuninitialized is
already documented in our manual and you'll find that it's behavior
is documented as being affected by optimizations. For example an
uninitialized use in a dead statement is already documented as
possibly not generating a warning. And that behavior has been with
us for, err, probably 15+ years.
> Right, "some people". However for others, it's important to find the
> so-called false positives that get optimized away.
ANd I've agreed multiple times that providing a mechanism to do that
is a good thing. Let's put this question to bed and focus on the
real issue, what is the behavior for -Wuninitialized.
> Consider "if (FOO) {use something uninit}" where FOO is zero or one.
> When defined to zero, the optimizer will kill the uninitialized stmt,
> but I want to see the warning here since it will help me fix code that
> will be used when FOO is one.
And again I've agreed multiple times that providing a mechanism to
do this is a good thing.
What we're in disagreement about is whether or not that class of
warnings should be triggered by -Wuninitialized. I STRONGLY believe
that -Wuninitialized should remain as-is in its documented behavior
and that we should have a distinct switch to get the new behavior.
At this point I'm so bloody frustrated by this discussion that I'm
about ready to throw the trivial changes over the wall and let
someone else deal with the problem.
Jeff