This is the mail archive of the gcc@gcc.gnu.org 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: -Wuninitialized issues


 > 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



 > > False positives for -Wuninitialized are easily corrected by
 > > initializing at declaration.
 > 
 > But for some people, that's just a make-work project; it's also
 > in a way further pushing our ideas on software development to
 > the end users.  ie, *we* may think that adding the initialization
 > is an easy correction, but others may violently disagree.

Right, "some people".  However for others, it's important to find the
so-called false positives that get optimized away.

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.



 > Plus, the set of newly detected false positives should be small,
 > very small if we do our job right.  ie, if we're triggering some
 > new false positive, then that means that an optimizer somewhere
 > hasn't done its job.

I've seen uninitialised warnings triggered or not depending on
inlining.  And whether a function is inlined can be a platform
dependent thing.  So I'm not confident running the uninit check after
optimizing will solve our problem or even get us close.

Anyway I could live with a flag that behaves like 3a.  (I'm still not
sure what happens in #4 when the flag is off.)

Why not try your patch and see how many of the meta-bug PRs it solves?

		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu


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