<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Feb 26, 2013 at 3:04 PM, Eli Bendersky <span dir="ltr"><<a href="mailto:eliben@google.com" target="_blank" class="cremed">eliben@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: eliben<br>
Date: Tue Feb 26 17:04:17 2013<br>
New Revision: 176134<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=176134&view=rev" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project?rev=176134&view=rev</a><br>
Log:<br>
Try to get rid of a -wunitialized warning: explicitly initialize the pointer<br>
to NULL and use asserts to check in relevant places.<br></blockquote><div><br></div><div style>I assume GCC's -Wuninitialized?</div><div style><br></div><div style>I thought we turned that off due to the false positives like this.</div>
<div style><br></div><div style>I'm really opposed to littering the code with dead stores to placate this warning. It undermines our ability to use Valgrind to catch actual uninitialized bugs.</div><div style> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Modified:<br>
llvm/trunk/tools/llvm-mc/llvm-mc.cpp<br>
<br>
Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=176134&r1=176133&r2=176134&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=176134&r1=176133&r2=176134&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original)<br>
+++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Tue Feb 26 17:04:17 2013<br>
@@ -427,7 +427,7 @@ int main(int argc, char **argv) {<br>
OwningPtr<MCSubtargetInfo><br>
STI(TheTarget->createMCSubtargetInfo(TripleName, MCPU, FeaturesStr));<br>
<br>
- MCInstPrinter *IP;<br>
+ MCInstPrinter *IP = NULL;<br>
if (FileType == OFT_AssemblyFile) {<br>
IP =<br>
TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI, *MCII, *MRI, *STI);<br>
@@ -465,10 +465,12 @@ int main(int argc, char **argv) {<br>
Res = AssembleInput(ProgName, TheTarget, SrcMgr, Ctx, *Str, *MAI, *STI);<br>
break;<br>
case AC_MDisassemble:<br>
+ assert(IP && "Expected assembly output");<br>
IP->setUseMarkup(1);<br>
disassemble = true;<br>
break;<br>
case AC_HDisassemble:<br>
+ assert(IP && "Expected assembly output");<br>
IP->setPrintImmHex(1);<br>
disassemble = true;<br>
break;<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" class="cremed">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank" class="cremed">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>