summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/APFloat.cpp
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2014-09-06 00:41:19 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2014-09-06 00:41:19 +0000
commitba1ecbc7d399a77b490583c24c8ba658a84b55b8 (patch)
treec36dafefeb469cfd42a63f3d03cae412c82c533c /llvm/lib/Support/APFloat.cpp
parent091405d7e3ad525f744dfe0990718d6a6f201721 (diff)
downloadbcm5719-llvm-ba1ecbc7d399a77b490583c24c8ba658a84b55b8.tar.gz
bcm5719-llvm-ba1ecbc7d399a77b490583c24c8ba658a84b55b8.zip
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
Diffstat (limited to 'llvm/lib/Support/APFloat.cpp')
-rw-r--r--llvm/lib/Support/APFloat.cpp4
1 files changed, 3 insertions, 1 deletions
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
OpenPOWER on IntegriCloud