From 6f96ce2be85fbc2eb0e387cb4834cf4c739fc6c8 Mon Sep 17 00:00:00 2001
From: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Sun, 31 Oct 1999 04:22:46 +0000
Subject: [PATCH]         * fold-const.c (fold): Fix thinko when optimizing
 comparisons         against -0.0.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30282 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog    | 5 +++++
 gcc/fold-const.c | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f77c788a7541..1d60c3a30670 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+Sat Oct 30 22:19:26 1999  Jeffrey A Law  (law@cygnus.com)
+
+	* fold-const.c (fold): Fix thinko when optimizing comparisons
+	against -0.0.
+
 Sat Oct 30 21:32:17 1999  David Starner  <dstarner98@aasaa.ofe.org>
 
 	* gcc.texi (Passes): Update front-end files to their current 
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index f633fa85f138..49f61b8e5566 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -5751,7 +5751,8 @@ fold (expr)
 				  REAL_VALUE_NEGATE (TREE_REAL_CST (arg1)))));
 	  /* IEEE doesn't distinguish +0 and -0 in comparisons.  */
 	  /* a CMP (-0) -> a CMP 0  */
-	  if (REAL_VALUE_MINUS_ZERO (TREE_REAL_CST (arg1)))
+	  if (TREE_CODE (arg1) == REAL_CST
+	      && REAL_VALUE_MINUS_ZERO (TREE_REAL_CST (arg1)))
 	    return fold (build (code, type, arg0,
 				build_real (TREE_TYPE (arg1), dconst0)));
 	}
-- 
GitLab