aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/APFloat.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-11-25 19:00:29 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-11-25 19:00:29 +0000
commit88f2d6c167a575e5d9c62ecb211ff4d825b09ed3 (patch)
treedbd39813ba5553bff2dcc2e800a61744e1ab1081 /lib/Support/APFloat.cpp
parent878ef1d5bc3b2d12f58fbd796a4ac91b163c88f0 (diff)
convertToSignExtendedInteger should return opInvalidOp instead of asserting if sematics of float does not allow arithmetics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60042 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/APFloat.cpp')
-rw-r--r--lib/Support/APFloat.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp
index a65e55afb5..128fee4f01 100644
--- a/lib/Support/APFloat.cpp
+++ b/lib/Support/APFloat.cpp
@@ -117,6 +117,11 @@ namespace {
&& "Compile-time arithmetic does not support these semantics");
}
+ static inline bool
+ isArithmeticOk(const llvm::fltSemantics &semantics) {
+ return semantics.arithmeticOK;
+ }
+
/* Return the value of a decimal exponent of the form
[+-]ddddddd.
@@ -1787,7 +1792,8 @@ APFloat::convertToSignExtendedInteger(integerPart *parts, unsigned int width,
const integerPart *src;
unsigned int dstPartsCount, truncatedBits;
- assertArithmeticOK(*semantics);
+ if (!isArithmeticOk(*semantics))
+ return opInvalidOp;
*isExact = false;