Commit 8936c82f by Roger Sayle Committed by Roger Sayle

fold-const.c (fold <EQ_EXPR>): Don't fold x == x only if x is a floating point…

fold-const.c (fold <EQ_EXPR>): Don't fold x == x only if x is a floating point type *and* we currently honor NaNs.


	* fold-const.c (fold <EQ_EXPR>):  Don't fold x == x only if x
	is a floating point type *and* we currently honor NaNs.
	(fold <NE_EXPR>): Likewise.

From-SVN: r67700
parent 5107c6e4
2003-06-10 Roger Sayle <roger@eyesopen.com>
* fold-const.c (fold <EQ_EXPR>): Don't fold x == x only if x
is a floating point type *and* we currently honor NaNs.
(fold <NE_EXPR>): Likewise.
2003-06-10 Mark Mitchell <mark@codesourcery.com> 2003-06-10 Mark Mitchell <mark@codesourcery.com>
PR c++/11131 PR c++/11131
......
...@@ -7046,15 +7046,18 @@ fold (expr) ...@@ -7046,15 +7046,18 @@ fold (expr)
case EQ_EXPR: case EQ_EXPR:
case GE_EXPR: case GE_EXPR:
case LE_EXPR: case LE_EXPR:
if (! FLOAT_TYPE_P (TREE_TYPE (arg0))) if (! FLOAT_TYPE_P (TREE_TYPE (arg0))
|| ! HONOR_NANS (TYPE_MODE (TREE_TYPE (arg0))))
return constant_boolean_node (1, type); return constant_boolean_node (1, type);
code = EQ_EXPR; code = EQ_EXPR;
TREE_SET_CODE (t, code); TREE_SET_CODE (t, code);
break; break;
case NE_EXPR: case NE_EXPR:
/* For NE, we can only do this simplification if integer. */ /* For NE, we can only do this simplification if integer
if (FLOAT_TYPE_P (TREE_TYPE (arg0))) or we don't honor IEEE floating point NaNs. */
if (FLOAT_TYPE_P (TREE_TYPE (arg0))
&& HONOR_NANS (TYPE_MODE (TREE_TYPE (arg0))))
break; break;
/* ... fall through ... */ /* ... fall through ... */
case GT_EXPR: case GT_EXPR:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment