From 5be22a12c2fdb4e13ead4b2e8a8a68f07fb1f270 Mon Sep 17 00:00:00 2001 From: Michael Ilseman Date: Fri, 12 Dec 2014 21:48:03 +0000 Subject: Clean up static analyzer warnings. Clang's static analyzer found several potential cases of undefined behavior, use of un-initialized values, and potentially null pointer dereferences in tablegen, Support, MC, and ADT. This cleans them up with specific assertions on the assumptions of the code. llvm-svn: 224154 --- llvm/lib/Support/ScaledNumber.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'llvm/lib/Support/ScaledNumber.cpp') diff --git a/llvm/lib/Support/ScaledNumber.cpp b/llvm/lib/Support/ScaledNumber.cpp index 725f4649613..3cd75091caf 100644 --- a/llvm/lib/Support/ScaledNumber.cpp +++ b/llvm/lib/Support/ScaledNumber.cpp @@ -169,8 +169,7 @@ static std::string toStringAPFloat(uint64_t D, int E, unsigned Precision) { int Shift = 63 - (NewE - E); assert(Shift <= LeadingZeros); assert(Shift == LeadingZeros || NewE == ScaledNumbers::MaxScale); - assert((Shift & (1u << std::numeric_limits::digits)) == 0 && - "undefined behavior"); + assert(Shift >= 0 && Shift < 64 && "undefined behavior"); D <<= Shift; E = NewE; -- cgit v1.2.3