[llvm] r199147 - Fix uninitialized warning in llvm/lib/IR/DataLayout.cpp.

Cameron McInally cameron.mcinally at nyu.edu
Mon Jan 13 14:04:56 PST 2014


Author: mcinally
Date: Mon Jan 13 16:04:55 2014
New Revision: 199147

URL: http://llvm.org/viewvc/llvm-project?rev=199147&view=rev
Log:
Fix uninitialized warning in llvm/lib/IR/DataLayout.cpp.

Added:
    llvm/trunk/test/Assembler/getInt.ll
Modified:
    llvm/trunk/lib/IR/DataLayout.cpp

Modified: llvm/trunk/lib/IR/DataLayout.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DataLayout.cpp?rev=199147&r1=199146&r2=199147&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DataLayout.cpp (original)
+++ llvm/trunk/lib/IR/DataLayout.cpp Mon Jan 13 16:04:55 2014
@@ -207,9 +207,10 @@ static std::pair<StringRef, StringRef> s
 
 /// Get an unsigned integer, including error checks.
 static unsigned getInt(StringRef R) {
-  unsigned Result = 0;
+  unsigned Result;
   bool error = R.getAsInteger(10, Result); (void)error;
-  assert(!error && "not a number, or does not fit in an unsigned int");
+  if (error)
+    report_fatal_error("not a number, or does not fit in an unsigned int");
   return Result;
 }
 

Added: llvm/trunk/test/Assembler/getInt.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/getInt.ll?rev=199147&view=auto
==============================================================================
--- llvm/trunk/test/Assembler/getInt.ll (added)
+++ llvm/trunk/test/Assembler/getInt.ll Mon Jan 13 16:04:55 2014
@@ -0,0 +1,4 @@
+; RUN: opt < %s
+; XFAIL: * 
+
+target datalayout = "p:4294967296:64:64"





More information about the llvm-commits mailing list