diff options
author | Chris Lattner <sabre@nondot.org> | 2012-04-23 00:27:54 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2012-04-23 00:27:54 +0000 |
commit | a9963c648e1646fe6fc1015a61a05b08a62d0aa8 (patch) | |
tree | b8aad6ac278379c1e5ea48e87b335ddf27e13e09 /lib/Support/StringRef.cpp | |
parent | 85d043d6f6b59518bdaa20ae1957cbf645fd0cd6 (diff) |
Don't die with an assertion if the Result bitwidth is already correct. This
fixes an assert reading "1239123123123123" when the result is already 64-bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155329 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/StringRef.cpp')
-rw-r--r-- | lib/Support/StringRef.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Support/StringRef.cpp b/lib/Support/StringRef.cpp index 14d314b769..97af0fff5e 100644 --- a/lib/Support/StringRef.cpp +++ b/lib/Support/StringRef.cpp @@ -391,7 +391,7 @@ bool StringRef::getAsInteger(unsigned Radix, APInt &Result) const { unsigned BitWidth = Log2Radix * Str.size(); if (BitWidth < Result.getBitWidth()) BitWidth = Result.getBitWidth(); // don't shrink the result - else + else if (BitWidth > Result.getBitWidth()) Result = Result.zext(BitWidth); APInt RadixAP, CharAP; // unused unless !IsPowerOf2Radix |