aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-08-11 08:33:24 +0000
committerRichard Stallman <rms@gnu.org>1992-08-11 08:33:24 +0000
commitb5c525860dc6e776b1ae2593bb9ed1a1b4fd42d8 (patch)
treee20291866f3e71ef73bf79ae0d46ed317c3d0c1b /gcc/fold-const.c
parenta6bf434760ab3c33eb6232cb5eba34ca6e4184ab (diff)
downloadgcc-b5c525860dc6e776b1ae2593bb9ed1a1b4fd42d8.zip
gcc-b5c525860dc6e776b1ae2593bb9ed1a1b4fd42d8.tar.gz
gcc-b5c525860dc6e776b1ae2593bb9ed1a1b4fd42d8.tar.bz2
(fold): Don't fold (A op B ? A : C) if A is IEEE
floating point, because A might be -0.0 or NaN. From-SVN: r1793
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 207c75a..6a12970 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -4007,9 +4007,12 @@ fold (expr)
/* If we have A op B ? A : C, we may be able to convert this to a
simpler expression, depending on the operation and the values
- of B and C. */
+ of B and C. IEEE floating point prevents this though,
+ because A or B might be -0.0 or a NaN. */
if (TREE_CODE_CLASS (TREE_CODE (arg0)) == '<'
+ && (TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT
+ || TREE_CODE (TREE_TYPE (TREE_OPERAND (arg0, 0))) != REAL_TYPE)
&& operand_equal_for_comparison_p (TREE_OPERAND (arg0, 0),
arg1, TREE_OPERAND (arg0, 1)))
{