aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/APFloat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/APFloat.cpp')
-rw-r--r--lib/Support/APFloat.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp
index 16a0c23292..619f061862 100644
--- a/lib/Support/APFloat.cpp
+++ b/lib/Support/APFloat.cpp
@@ -638,7 +638,8 @@ void APFloat::makeNaN(bool SNaN, bool Negative, const APInt *fill)
if (!fill || fill->getNumWords() < numParts)
APInt::tcSet(significand, 0, numParts);
if (fill) {
- APInt::tcAssign(significand, fill->getRawData(), partCount());
+ APInt::tcAssign(significand, fill->getRawData(),
+ std::min(fill->getNumWords(), numParts));
// Zero out the excess bits of the significand.
unsigned bitsToPreserve = semantics->precision - 1;