diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-08-03 16:57:03 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-08-03 16:57:03 +0000 |
| commit | 032610feb14bd69bf862e41c01465f464b11bf37 (patch) | |
| tree | 6ba9ff8e1bb271269c6f010bfee0795f36bf0504 /lib/Bitcode | |
| parent | 746f88d5151618b6ae4462a1690cc2e62bc87526 (diff) | |
| download | external_llvm-032610feb14bd69bf862e41c01465f464b11bf37.zip external_llvm-032610feb14bd69bf862e41c01465f464b11bf37.tar.gz external_llvm-032610feb14bd69bf862e41c01465f464b11bf37.tar.bz2 | |
avoid undefined behavior negating minint.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110117 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode')
| -rw-r--r-- | lib/Bitcode/Writer/BitcodeWriter.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index 93ca8cd..776c2d4 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -735,8 +735,8 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal, Code = bitc::CST_CODE_UNDEF; } else if (const ConstantInt *IV = dyn_cast<ConstantInt>(C)) { if (IV->getBitWidth() <= 64) { - int64_t V = IV->getSExtValue(); - if (V >= 0) + uint64_t V = IV->getSExtValue(); + if ((int64_t)V >= 0) Record.push_back(V << 1); else Record.push_back((-V << 1) | 1); |
