From 3da1400d07e473463df86668e1e50da8b02618fa Mon Sep 17 00:00:00 2001 From: dim Date: Sun, 6 Sep 2015 18:41:23 +0000 Subject: Import compiler-rt 3.7.0 release (r246257). --- lib/builtins/fp_extend_impl.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/builtins/fp_extend_impl.inc') 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. -- cgit v1.1