From b09b50cbe46b939aae0f9778ab0fc602fe314fbb Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Fri, 12 May 2017 18:19:01 +0000 Subject: [PATCH] [APInt] Add an assert to check for divide by zero in udivrem. NFC udiv and urem already had the same assert. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302931 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/APInt.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp index a5ffcb2e96d..f4aa627d6ce 100644 --- a/lib/Support/APInt.cpp +++ b/lib/Support/APInt.cpp @@ -1662,6 +1662,7 @@ void APInt::udivrem(const APInt &LHS, const APInt &RHS, // Get some size facts about the dividend and divisor unsigned lhsWords = getNumWords(LHS.getActiveBits()); unsigned rhsWords = getNumWords(RHS.getActiveBits()); + assert(rhsWords && "Performing divrem operation by zero ???"); // Check the degenerate cases if (lhsWords == 0) {