diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2005-11-16 17:15:23 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2005-11-16 17:15:23 +0000 |
commit | 68328cdaefaee1b9e218e08ff2955806ddd20403 (patch) | |
tree | 6894347795260dbf98ccdad4e02632f18f90f9e7 /gcc/fold-const.c | |
parent | 74d9c39f6aeaec9ed8a99167890283f4519219dd (diff) | |
download | gcc-68328cdaefaee1b9e218e08ff2955806ddd20403.tar.gz |
fold-const.c (const_binop): Don't constant fold the operation if the result has overflowed and...
* fold-const.c (const_binop): Don't constant fold the operation
if the result has overflowed and flag_trapping_math.
* simplify-rtx.c (simplify_const_binary_operation): Likewise.
From-SVN: r107092
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 6f829adfa77..0e74391fe51 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -1537,6 +1537,16 @@ const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc) inexact = real_arithmetic (&value, code, &d1, &d2); real_convert (&result, mode, &value); + /* Don't constant fold this floating point operation if + the result has overflowed and flag_trapping_math. */ + + if (flag_trapping_math + && MODE_HAS_INFINITIES (mode) + && REAL_VALUE_ISINF (result) + && !REAL_VALUE_ISINF (d1) + && !REAL_VALUE_ISINF (d2)) + return NULL_TREE; + /* Don't constant fold this floating point operation if the result may dependent upon the run-time rounding mode and flag_rounding_math is set, or if GCC's software emulation |