Fix uninitialized warning in llvm/lib/IR/DataLayout.cpp.
authorCameron McInally <cameron.mcinally@nyu.edu>
Mon, 13 Jan 2014 22:04:55 +0000 (22:04 +0000)
committerCameron McInally <cameron.mcinally@nyu.edu>
Mon, 13 Jan 2014 22:04:55 +0000 (22:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199147 91177308-0d34-0410-b5e6-96231b3b80d8

lib/IR/DataLayout.cpp
test/Assembler/getInt.ll [new file with mode: 0644]

index 7df867279b229f53c0a59337ff8541557a537811..7de41faac4f03c980be172beb438e69d6997867f 100644 (file)
@@ -207,9 +207,10 @@ static std::pair<StringRef, StringRef> split(StringRef Str, char Separator) {
 
 /// 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;
 }
 
diff --git a/test/Assembler/getInt.ll b/test/Assembler/getInt.ll
new file mode 100644 (file)
index 0000000..1363f40
--- /dev/null
@@ -0,0 +1,4 @@
+; RUN: opt < %s
+; XFAIL: * 
+
+target datalayout = "p:4294967296:64:64"