From 3bc400cdc1d413b96b07bf8d590a5e99bf9c326a Mon Sep 17 00:00:00 2001
From: Roger Sayle <sayle@gcc.gnu.org>
Date: Wed, 19 Feb 2003 22:59:33 +0000
Subject: [PATCH] fold-const.c (fold_real_zero_addition_p): Don't fold a zero
 addition in the presence of signaling NaNs.

	* fold-const.c (fold_real_zero_addition_p): Don't fold a zero
	addition in the presence of signaling NaNs.

From-SVN: r63133
---
 gcc/ChangeLog    | 12 +++++++++---
 gcc/fold-const.c |  4 ++++
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 26807a1c8992..da21d117faee 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2003-02-19  Roger Sayle  <roger@eyesopen.com>
+
+	* fold-const.c (fold_real_zero_addition_p): Don't fold a zero
+	addition in the presence of signaling NaNs.
+
 2003-02-19  Krister Walfridsson  <cato@df.lth.se>
 
 	* tm.texi (INIT_CUMULATIVE_ARGS): Fix typo.
@@ -109,9 +114,10 @@ Tue Feb 18 23:50:59 CET 2003  Jan Hubicka  <jh@suse.cz>
 	(cgraph_expand_function): Rewrite.
 
 2003-02-18  Matt Austern <austern@apple.com>
+
 	* toplev.c, langhooks.c, langhooks-def.h: Move
 	write_global_declarations from toplev.c to langhooks.c. 
-	
+
 2003-02-18  Kazu Hirata  <kazu@cs.umass.edu>
 
 	* config/h8300/h8300.c (general_operand_src): Always check
@@ -168,8 +174,8 @@ Tue Feb 18 23:50:59 CET 2003  Jan Hubicka  <jh@suse.cz>
 
 Tue Feb 18 20:15:54 2003  J"orn Rennecke <joern.rennecke@superh.com>
 
-	* sh.c (calc_live_regs): Also check GET_CODE when checking if initial value
-	for PR_REG is still the PR_REG register.
+	* sh.c (calc_live_regs): Also check GET_CODE when checking if
+	initial value for PR_REG is still the PR_REG register.
 
 2003-02-18  Jim Wilson  <wilson@redhat.com>
 
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 5dfa1e413ec7..6b50a86a097b 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -4642,6 +4642,10 @@ fold_real_zero_addition_p (type, addend, negate)
   if (!real_zerop (addend))
     return false;
 
+  /* Don't allow the fold with -fsignaling-nans.  */
+  if (HONOR_SNANS (TYPE_MODE (type)))
+    return false;
+
   /* Allow the fold if zeros aren't signed, or their sign isn't important.  */
   if (!HONOR_SIGNED_ZEROS (TYPE_MODE (type)))
     return true;
-- 
GitLab