[cfe-commits] r159620 - in /cfe/trunk: lib/Analysis/UninitializedValues.cpp test/Sema/uninit-variables.c

Richard Smith richard at metafoo.co.uk
Thu Jul 5 15:06:25 PDT 2012


On Thu, Jul 5, 2012 at 7:14 AM, Joerg Sonnenberger
<joerg at britannica.bec.de>wrote:

> On Tue, Jul 03, 2012 at 12:37:44PM -0700, Richard Smith wrote:
> > On Tue, Jul 3, 2012 at 1:14 AM, Joerg Sonnenberger
> > <joerg at britannica.bec.de>wrote:
> >
> > > On Mon, Jul 02, 2012 at 11:23:05PM -0000, Richard Smith wrote:
> > > > Log:
> > > > -Wuninitialized: assume that an __attribute__((returns_twice))
> function
> > > might
> > > > initialize any variable. This is extremely conservative, but is
> > > sufficient for
> > > > now.
> > >
> > > Can this be reduced to following both code paths if the function call
> is
> > > part of a conditional?
> >
> >
> > I'm not sure what you're suggesting; we do follow both code paths after a
> > conditional. If you mean that we should track whether the function
> returned
> > a nonzero value, and not apply this logic in that case, then I think
> that's
> > out of scope for this check, and belongs in the static analyzer (if
> > anywhere).
>
> Consider the attached test case. I think we definitely want to warn
> here.


With the approach I suggested, we would do so (although for more complex
cases, we would not). Are you suggesting that we should somehow track
whether there exists any variable which is used uninitialized irrespective
of the return value of setjmp? That sounds like a correct criterion, so if
you have a suggestion for a way to implement it efficiently, that would be
interesting.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120705/8c123b99/attachment.html>


More information about the cfe-commits mailing list