aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support/APInt.cpp
diff options
context:
space:
mode:
authorAhmed Charles <ace2001ac@gmail.com>2012-02-24 19:06:15 +0000
committerAhmed Charles <ace2001ac@gmail.com>2012-02-24 19:06:15 +0000
commit969b739fb9ff89603a3cb3acc6af0eb561cfa5d4 (patch)
treecbf50a10d12644b764ed241f53a72e870749cacf /lib/Support/APInt.cpp
parent9e931f6a64d329276d6253ec1baec9df96f4bbd6 (diff)
downloadexternal_llvm-969b739fb9ff89603a3cb3acc6af0eb561cfa5d4.zip
external_llvm-969b739fb9ff89603a3cb3acc6af0eb561cfa5d4.tar.gz
external_llvm-969b739fb9ff89603a3cb3acc6af0eb561cfa5d4.tar.bz2
Fix undefined behavior.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151385 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/APInt.cpp')
-rw-r--r--lib/Support/APInt.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp
index c580dd3..0d4e0f9 100644
--- a/lib/Support/APInt.cpp
+++ b/lib/Support/APInt.cpp
@@ -1234,7 +1234,7 @@ APInt APInt::lshr(const APInt &shiftAmt) const {
/// @brief Logical right-shift function.
APInt APInt::lshr(unsigned shiftAmt) const {
if (isSingleWord()) {
- if (shiftAmt == BitWidth)
+ if (shiftAmt >= BitWidth)
return APInt(BitWidth, 0);
else
return APInt(BitWidth, this->VAL >> shiftAmt);