This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR67052
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>
- Date: Thu, 30 Jul 2015 13:19:51 +0200 (CEST)
- Subject: [PATCH] Fix PR67052
- Authentication-results: sourceware.org; auth=none
The following patch avoids folding NaN < 0 to false if -ftrapping-math
is in effect.
Bootstrap & regtest pending on x86_64-unknown-linux-gnu.
Richard.
2015-07-30 Richard Biener <rguenther@suse.de>
PR middle-end/67052
* fold-const.c (fold_binary_loc): Do not fold NaN < 0 to false
if FP math can trap.
Index: gcc/fold-const.c
===================================================================
--- gcc/fold-const.c (revision 226387)
+++ gcc/fold-const.c (working copy)
@@ -11634,7 +11455,9 @@ fold_binary_loc (location_t loc,
/* Convert ABS_EXPR<x> < 0 to false. */
strict_overflow_p = false;
if (code == LT_EXPR
- && (integer_zerop (arg1) || real_zerop (arg1))
+ && (integer_zerop (arg1)
+ || ((! HONOR_NANS (arg0) || !flag_trapping_math)
+ && real_zerop (arg1)))
&& tree_expr_nonnegative_warnv_p (arg0, &strict_overflow_p))
{
if (strict_overflow_p)