(fold): Don't fold (A op B ? A : C) if A is IEEE
authorRichard Stallman <rms@gnu.org>
Tue, 11 Aug 1992 08:33:24 +0000 (08:33 +0000)
committerRichard Stallman <rms@gnu.org>
Tue, 11 Aug 1992 08:33:24 +0000 (08:33 +0000)
floating point, because A might be -0.0 or NaN.

From-SVN: r1793

gcc/fold-const.c

index 207c75a8e17abfd19f40f2a25ada47e36094618a..6a1297097adda149911053c70d8c4806eb9ec869 100644 (file)
@@ -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)))
        {