[Bug c++/97965] constexpr evaluation vs. NaNs inconsistency

2020-12-08 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97965

--- Comment #3 from Jakub Jelinek  ---
https://gcc.gnu.org/pipermail/gcc-patches/2020-November/560463.html
https://gcc.gnu.org/pipermail/gcc-patches/2020-November/560515.html
are some mails on the topic.

[Bug c++/97965] constexpr evaluation vs. NaNs inconsistency

2020-12-08 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97965

--- Comment #2 from Jason Merrill  ---
See also PR88683 and PR88173.

I notice that the match.pd REAL_CST patterns starting around line 4045 only
look at the RHS of the comparison, so that nan > inf is handled very
differently from inf < nan.  And tree_swap_operands_p doesn't swap them around
to make it work properly.

#define inf __builtin_huge_val()
#define nan __builtin_nan("")

constexpr bool b1 = inf > nan;
constexpr bool b2 = nan < inf;

[Bug c++/97965] constexpr evaluation vs. NaNs inconsistency

2020-11-24 Thread joseph at codesourcery dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97965

--- Comment #1 from joseph at codesourcery dot com  ---
I don't think there should be any difference between quiet and signaling 
NaNs here, since < <= > >= comparisons with either kind of NaN raise 
"invalid"; it's == != (and the __builtin_is* comparisons) that only raise 
exceptions for signaling NaN but not quiet.