From 28dd960cd1c346c5beef4585d6ea68ae31be0faf Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Fri, 8 Jun 2012 18:04:52 +0000 Subject: Fix a crash in APInt::lshr when shiftAmt > BitWidth. Patch by James Benton . git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158213 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/APInt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp index 9b81fe7..6a74883 100644 --- a/lib/Support/APInt.cpp +++ b/lib/Support/APInt.cpp @@ -1135,7 +1135,7 @@ APInt APInt::lshr(unsigned shiftAmt) const { // If all the bits were shifted out, the result is 0. This avoids issues // with shifting by the size of the integer type, which produces undefined // results. We define these "undefined results" to always be 0. - if (shiftAmt == BitWidth) + if (shiftAmt >= BitWidth) return APInt(BitWidth, 0); // If none of the bits are shifted out, the result is *this. This avoids -- cgit v1.1