[PATCH] Fixing warnings revealed by gcc release build

Edwin Vane edwin.vane at intel.com
Tue Jan 29 06:18:07 PST 2013


Hi gribozavr,

Fixed used-uninitialized and set-but-not-used warnings.

http://llvm-reviews.chandlerc.com/D341

Files:
  lib/CodeGen/StackColoring.cpp
  lib/IR/DataLayout.cpp
  lib/Target/X86/AsmParser/X86AsmParser.cpp
  lib/Transforms/Instrumentation/MemorySanitizer.cpp
  lib/Transforms/Scalar/SROA.cpp
  tools/llvm-mc/llvm-mc.cpp

Index: lib/CodeGen/StackColoring.cpp
===================================================================
--- lib/CodeGen/StackColoring.cpp
+++ lib/CodeGen/StackColoring.cpp
@@ -202,7 +202,7 @@
 void StackColoring::dump() {
   for (df_iterator<MachineFunction*> FI = df_begin(MF), FE = df_end(MF);
        FI != FE; ++FI) {
-    unsigned Num = BasicBlocks[*FI];
+    unsigned Num = BasicBlocks[*FI]; (void)Num;
     DEBUG(dbgs()<<"Inspecting block #"<<Num<<" ["<<FI->getName()<<"]\n");
     Num = 0;
     DEBUG(dbgs()<<"BEGIN  : {");
Index: lib/IR/DataLayout.cpp
===================================================================
--- lib/IR/DataLayout.cpp
+++ lib/IR/DataLayout.cpp
@@ -187,7 +187,7 @@
 
 /// Get an unsinged integer, including error checks.
 static unsigned getInt(StringRef R) {
-  unsigned Result;
+  unsigned Result = 0;
   bool error = R.getAsInteger(10, Result); (void)error;
   assert(!error && "not a number, or does not fit in an unsigned int");
   return Result;
Index: lib/Target/X86/AsmParser/X86AsmParser.cpp
===================================================================
--- lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -2079,7 +2079,7 @@
   // Check for the various suffix matches.
   Tmp[Base.size()] = Suffixes[0];
   unsigned ErrorInfoIgnore;
-  unsigned ErrorInfoMissingFeature;
+  unsigned ErrorInfoMissingFeature = 0;
   unsigned Match1, Match2, Match3, Match4;
 
   Match1 = MatchInstructionImpl(Operands, Inst, ErrorInfoIgnore,
Index: lib/Transforms/Instrumentation/MemorySanitizer.cpp
===================================================================
--- lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -1594,6 +1594,7 @@
       if (MS.TrackOrigins)
         IRB.CreateStore(getOrigin(A),
                         getOriginPtrForArgument(A, IRB, ArgOffset));
+      (void)Store;
       assert(Size != 0 && Store != 0);
       DEBUG(dbgs() << "  Param:" << *Store << "\n");
       ArgOffset += DataLayout::RoundUpAlignment(Size, 8);
Index: lib/Transforms/Scalar/SROA.cpp
===================================================================
--- lib/Transforms/Scalar/SROA.cpp
+++ lib/Transforms/Scalar/SROA.cpp
@@ -2971,6 +2971,7 @@
     else
       New = IRB.CreateLifetimeEnd(Ptr, Size);
 
+    (void)New;
     DEBUG(dbgs() << "          to: " << *New << "\n");
     return true;
   }
Index: tools/llvm-mc/llvm-mc.cpp
===================================================================
--- tools/llvm-mc/llvm-mc.cpp
+++ tools/llvm-mc/llvm-mc.cpp
@@ -427,7 +427,7 @@
   OwningPtr<MCSubtargetInfo>
     STI(TheTarget->createMCSubtargetInfo(TripleName, MCPU, FeaturesStr));
 
-  MCInstPrinter *IP;
+  MCInstPrinter *IP = 0;
   if (FileType == OFT_AssemblyFile) {
     IP =
       TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI, *MCII, *MRI, *STI);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D341.1.patch
Type: text/x-patch
Size: 2905 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130129/26dd41cd/attachment.bin>


More information about the llvm-commits mailing list