<div class="gmail_quote">I really would like to avoid silencing the GCC "may be used uninitialized" warnings by introducing unnecessary initialization.</div><div class="gmail_quote"><br></div><div class="gmail_quote">
These warnings are almost always false positives due to the way the warning was implemented. What it means is that GCC has been unable to *prove* initialization took place, and has not hit one of a (very short) list of known impossible cases. This warning was bad enough that we (Google) lobbied upstream and I believe it is now under a separate flag from -Wuninitialized.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">Every time we add initializations like this we achieve three things:</div><div class="gmail_quote"><br></div><div class="gmail_quote">1) placate a fundamentally flawed warning</div>
<div class="gmail_quote">2) slow down code in some cases (the ability to eliminate the initialization corresponds to when this warning *doesn't* fire)</div><div class="gmail_quote">3) prevent us from ever getting Valgrind errors if we in fact introduce a bug leaving the variable uninitialized.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">It is #3 that makes me really bothered by the spirit of these changes. I would like to recommend anyone using an older GCCs should simply disable -Wuninitialized. We will catch all of the bugs with Clang's -Wuninitialized and Valgrind.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">On Wed, Feb 29, 2012 at 1:16 PM, Chad Rosier <span dir="ltr"><<a href="mailto:mcrosier@apple.com">mcrosier@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Eli took care of this in r151754.<br>
<span class="HOEnZb"><font color="#888888"><br>
 Chad<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Feb 29, 2012, at 12:54 PM, David Greene wrote:<br>
<br>
> I get the follwing build errors with -Werror:<br>
><br>
> [sta-opt]    : [llvm] /ptmp/dag/llvm/staging/llvm/tools/clang/lib/AST/Expr.cpp: In static member function 'static int clang::StringLiteral::mapCharByteWidth(const clang::TargetInfo&, clang::StringLiteral::StringKind)':<br>

> [sta-opt]    : [llvm] /ptmp/dag/llvm/staging/llvm/tools/clang/lib/AST/Expr.cpp:518:80: error: 'CharByteWidth' may be used uninitialized in this function [-Werror=uninitialized]<br>
> [sta-opt]    : [llvm] cc1plus: all warnings being treated as errors<br>
><br>
> Can someone fix this?  I don't have commit access.<br>
><br>
> Thanks!<br>
><br>
>                             -Dave<br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</div></div></blockquote></div><br>