diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-08-18 00:33:47 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-08-18 00:33:47 +0000 |
| commit | 46ce79706ce5e10c39934be4217a6fa9aae1f634 (patch) | |
| tree | 8fd702c3f710790f04753abb999b75ba356e0d10 | |
| parent | 78a6b4e3e7e6f73dea4bc886e2443362357e2d5e (diff) | |
| download | external_llvm-46ce79706ce5e10c39934be4217a6fa9aae1f634.zip external_llvm-46ce79706ce5e10c39934be4217a6fa9aae1f634.tar.gz external_llvm-46ce79706ce5e10c39934be4217a6fa9aae1f634.tar.bz2 | |
stomp some more undefined behavior, PR7775.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111337 91177308-0d34-0410-b5e6-96231b3b80d8
| -rw-r--r-- | lib/Support/APInt.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp index 262fa42..8a212a2 100644 --- a/lib/Support/APInt.cpp +++ b/lib/Support/APInt.cpp @@ -2123,15 +2123,16 @@ void APInt::toString(SmallVectorImpl<char> &Str, unsigned Radix, char *BufPtr = Buffer+65; uint64_t N; - if (Signed) { + if (!Signed) { + N = getZExtValue(); + } else { int64_t I = getSExtValue(); - if (I < 0) { + if (I >= 0) { + N = I; + } else { Str.push_back('-'); - I = -I; + N = -(uint64_t)I; } - N = I; - } else { - N = getZExtValue(); } while (N) { |
