From ba1ecbc7d399a77b490583c24c8ba658a84b55b8 Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Sat, 6 Sep 2014 00:41:19 +0000 Subject: Fix right shift by 64 bits detected on CXX/lex/lex.literal/lex.ext/p4.cpp test case on UBSan bootstrap bot. This fixes the last failure of "check-clang" in UBSan bootstrap bot. llvm-svn: 217294 --- llvm/lib/Support/APFloat.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Support/APFloat.cpp') diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp index 7989e30afae..097986d3e7c 100644 --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/lib/Support/APFloat.cpp @@ -3377,7 +3377,9 @@ void APFloat::makeLargest(bool Negative) { // internal consistency. const unsigned NumUnusedHighBits = PartCount*integerPartWidth - semantics->precision; - significand[PartCount - 1] = ~integerPart(0) >> NumUnusedHighBits; + significand[PartCount - 1] = (NumUnusedHighBits < integerPartWidth) + ? (~integerPart(0) >> NumUnusedHighBits) + : 0; } /// Make this number the smallest magnitude denormal number in the given -- cgit v1.2.3