On Thu, 26 Nov 2020, Richard Biener wrote: > Is copysign (x, NaN) supposed to be well-defined? We'd stop folding
copysign with NaN arguments (including sNaN) is well-defined and copies the sign bit without raising any exceptions. > this then, no? I think the ABS_EXPR<x> < 0 to false folding is > simply incomplete and should first check whether the operands are > ordered? That said, NaN is nonnegative but NaN < 0 isn't false(?) Comparisons involving NaN with < <= > >= == all return false. For example, with -fno-trapping-math, it's valid to fold fabs (anything) < 0 to false (preserving any side effects from evaluating "anything"), but it's not valid to fold fabs (anything) >= 0 to true, because NaN < 0 and NaN >= 0 are both false. With -ftrapping-math, neither can be folded if the argument might be a NaN. -- Joseph S. Myers jos...@codesourcery.com