From 486fdf2e654c419f013d463abad4aef575b4c11b Mon Sep 17 00:00:00 2001 From: Cameron McInally Date: Mon, 13 Jan 2014 22:04:55 +0000 Subject: [PATCH] Fix uninitialized warning in llvm/lib/IR/DataLayout.cpp. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199147 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/DataLayout.cpp | 5 +++-- test/Assembler/getInt.ll | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 test/Assembler/getInt.ll diff --git a/lib/IR/DataLayout.cpp b/lib/IR/DataLayout.cpp index 7df867279b2..7de41faac4f 100644 --- a/lib/IR/DataLayout.cpp +++ b/lib/IR/DataLayout.cpp @@ -207,9 +207,10 @@ static std::pair 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 index 00000000000..1363f401967 --- /dev/null +++ b/test/Assembler/getInt.ll @@ -0,0 +1,4 @@ +; RUN: opt < %s +; XFAIL: * + +target datalayout = "p:4294967296:64:64" -- 2.34.1