[cfe-dev] new -Wuninitialized implementation in Clang

Chandler Carruth chandlerc at google.com
Thu Feb 3 22:43:46 PST 2011

On Thu, Feb 3, 2011 at 10:34 PM, Ted Kremenek <kremenek at apple.com> wrote:

> On Feb 3, 2011, at 9:34 PM, Nico Weber wrote:
> > My personal impression is that it can be difficult to understand when
> > this new mechanism warns, and most of the time when it warns, it's
> > warns about false positives.
> I'm not certain if the second statement is truly fair.  This is code that
> has already been vetted for uses of uninitialized values.  Your point is
> taken, however, that the remaining false positives are noise that GCC
> doesn't warn about.  The question I'd rather we focus on asking is what
> should we do about those cases?

While my suggestion above about annotations to indicate acknowledged lack of
initialization were intended primarily for performance sensitive code paths,
the approach could be used in code paths where humans trivially conclude
that initialization isn't needed, and would prefer explicitly saying that
rather than doing a redundant explicit initialization.

Improving the smarts of the diagnostic to simply detect the initialization
is appealing in the sense that it makes the warnings go away without code
changes, but less appealing as you've indicated because it actually makes
the warnings less predictable and more expensive to provide.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110203/dcc88e33/attachment.html>

More information about the cfe-dev mailing list