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

Joerg Sonnenberger joerg at britannica.bec.de
Thu Jul 5 07:14:30 PDT 2012


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.

Joerg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.c
Type: text/x-csrc
Size: 178 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120705/a1dc3d1c/attachment.c>


More information about the cfe-commits mailing list