[llvm-commits] [llvm] r151385 - /llvm/trunk/lib/Support/APInt.cpp

Ahmed Charles ace2001ac at gmail.com
Fri Feb 24 11:06:15 PST 2012


Author: ace2001ac
Date: Fri Feb 24 13:06:15 2012
New Revision: 151385

URL: http://llvm.org/viewvc/llvm-project?rev=151385&view=rev
Log:
Fix undefined behavior.

Modified:
    llvm/trunk/lib/Support/APInt.cpp

Modified: llvm/trunk/lib/Support/APInt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=151385&r1=151384&r2=151385&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APInt.cpp (original)
+++ llvm/trunk/lib/Support/APInt.cpp Fri Feb 24 13:06:15 2012
@@ -1234,7 +1234,7 @@
 /// @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);





More information about the llvm-commits mailing list