summaryrefslogtreecommitdiffstats
path: root/lib/builtins/fp_extend_impl.inc
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2015-09-06 18:41:23 +0000
committerdim <dim@FreeBSD.org>2015-09-06 18:41:23 +0000
commit3da1400d07e473463df86668e1e50da8b02618fa (patch)
treeb259e5d585da0f8cde9579939a74d5ef44c72abd /lib/builtins/fp_extend_impl.inc
parentd423c65af723ebf09d0356d1833a035e7c6e7aad (diff)
downloadFreeBSD-src-3da1400d07e473463df86668e1e50da8b02618fa.zip
FreeBSD-src-3da1400d07e473463df86668e1e50da8b02618fa.tar.gz
Import compiler-rt 3.7.0 release (r246257).
Diffstat (limited to 'lib/builtins/fp_extend_impl.inc')
-rw-r--r--lib/builtins/fp_extend_impl.inc4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/builtins/fp_extend_impl.inc b/lib/builtins/fp_extend_impl.inc
index f6953ff..edcfa8d 100644
--- a/lib/builtins/fp_extend_impl.inc
+++ b/lib/builtins/fp_extend_impl.inc
@@ -66,7 +66,9 @@ static inline dst_t __extendXfYf2__(src_t a) {
const src_rep_t sign = aRep & srcSignMask;
dst_rep_t absResult;
- if (aAbs - srcMinNormal < srcInfinity - srcMinNormal) {
+ // If sizeof(src_rep_t) < sizeof(int), the subtraction result is promoted
+ // to (signed) int. To avoid that, explicitly cast to src_rep_t.
+ if ((src_rep_t)(aAbs - srcMinNormal) < srcInfinity - srcMinNormal) {
// a is a normal number.
// Extend to the destination type by shifting the significand and
// exponent into the proper position and rebiasing the exponent.
OpenPOWER on IntegriCloud