This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -Wuninitialized issues
On Mon, 2005-10-31 at 20:46 -0800, Ian Lance Taylor wrote:
> Jeffrey A Law <law@redhat.com> writes:
>
> > We clearly disagree then. Though my 15+ years of working with GCC I've
> > seen far more complaints about false positives than missing instances
> > of this warning.
>
> I think that most of the false positives are of the form
>
> int x, f, y;
> f = foo ();
> if (f)
> x = 1;
> y = g ();
> if (f)
> y = x;
> return y;
>
> Here presumably we can all agree that gcc ideally should not warn that
> x may be used uninitialized.
That's a little over-simplistic these days -- the jump threading code should
be able to clean that up enough that no warning is issued anymore. But
it's rather straightforward to extend that code to a form we don't
handle well (but could in the future).
f = foo();
g = bar ();
if (f)
x = 1;
if (g)
something
else
more code
if (f)
y = x;
return y;
It's possible to handle some of these cases -- it's just a matter of
more code :-0
jeff