On Thu, 30 Jul 2015, Richard Biener wrote: > > The following patch avoids folding NaN < 0 to false if -ftrapping-math > is in effect. > > Bootstrap & regtest pending on x86_64-unknown-linux-gnu.
FAIL: gcc.dg/fold-abs-4.c scan-tree-dump-times gimple "ABS" 0 FAIL: gcc.dg/pr15784-1.c scan-tree-dump-times gimple "ABS_EXPR" 0 FAIL: gcc.dg/tree-ssa/pr20139.c scan-tree-dump-times optimized "link_error" 0 all cases expect the transform to happen without -fno-trapping-math. Shall I adjust those testcases or is my patch wrong? Thanks, Richard. > Richard. > > 2015-07-30 Richard Biener <rguent...@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)