From 8936c82f1ea5c9146ca32ac5c75ab166d242cf0d Mon Sep 17 00:00:00 2001 From: Roger Sayle Date: Tue, 10 Jun 2003 13:00:17 +0000 Subject: [PATCH] fold-const.c (fold ): Don't fold x == x only if x is a floating point type *and* we currently honor NaNs. * fold-const.c (fold ): Don't fold x == x only if x is a floating point type *and* we currently honor NaNs. (fold ): Likewise. From-SVN: r67700 --- gcc/ChangeLog | 6 ++++++ gcc/fold-const.c | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3c34fe2c21f..6ef9b931460 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2003-06-10 Roger Sayle + + * fold-const.c (fold ): Don't fold x == x only if x + is a floating point type *and* we currently honor NaNs. + (fold ): Likewise. + 2003-06-10 Mark Mitchell PR c++/11131 diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 1f118e891eb..7b0f2cc533e 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -7046,15 +7046,18 @@ fold (expr) case EQ_EXPR: case GE_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); code = EQ_EXPR; TREE_SET_CODE (t, code); break; case NE_EXPR: - /* For NE, we can only do this simplification if integer. */ - if (FLOAT_TYPE_P (TREE_TYPE (arg0))) + /* For NE, we can only do this simplification if integer + or we don't honor IEEE floating point NaNs. */ + if (FLOAT_TYPE_P (TREE_TYPE (arg0)) + && HONOR_NANS (TYPE_MODE (TREE_TYPE (arg0)))) break; /* ... fall through ... */ case GT_EXPR: -- 2.30.2