diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-16 17:15:23 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-16 17:15:23 +0000 |
commit | f2e0dda3066e3d34f0c5424885bf4b1e5591fd81 (patch) | |
tree | 6894347795260dbf98ccdad4e02632f18f90f9e7 /gcc/simplify-rtx.c | |
parent | 363d487eb26583d7e66b35d055543cf7e3348dd9 (diff) | |
download | gcc-f2e0dda3066e3d34f0c5424885bf4b1e5591fd81.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107092 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r-- | gcc/simplify-rtx.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 44a1660e688..657b2b59c23 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -2242,6 +2242,17 @@ simplify_const_binary_operation (enum rtx_code code, enum machine_mode mode, &f0, &f1); 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 (f0) + && !REAL_VALUE_ISINF (f1)) + /* Overflow plus exception. */ + return 0; + /* 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 |