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
This commit is contained in:
Alexey Samsonov 2014-09-06 00:41:19 +00:00
parent 091405d7e3
commit ba1ecbc7d3
1 changed files with 3 additions and 1 deletions

View File

@ -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