aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2022-10-10 11:15:43 +0200
committerAldy Hernandez <aldyh@redhat.com>2022-10-10 14:50:17 +0200
commit69988cd58becc115b236f88627fe92436baaa674 (patch)
treee0c80e32456104204484c038443e3da3cc333985 /gcc
parent58fa21622b01d6064024c92bb09fb60fa5b75977 (diff)
downloadgcc-69988cd58becc115b236f88627fe92436baaa674.zip
gcc-69988cd58becc115b236f88627fe92436baaa674.tar.gz
gcc-69988cd58becc115b236f88627fe92436baaa674.tar.bz2
The true side of x != x should set NAN.
gcc/ChangeLog: * range-op-float.cc (foperator_not_equal::op1_range): Set NAN on TRUE side for x != x.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/range-op-float.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc
index 91833d3..5ffe38d 100644
--- a/gcc/range-op-float.cc
+++ b/gcc/range-op-float.cc
@@ -497,14 +497,17 @@ bool
foperator_not_equal::op1_range (frange &r, tree type,
const irange &lhs,
const frange &op2,
- relation_kind) const
+ relation_kind rel) const
{
switch (get_bool_state (r, lhs, type))
{
case BRS_TRUE:
+ // The TRUE side of op1 != op1 implies op1 is NAN.
+ if (rel == VREL_EQ)
+ r.set_nan (type);
// If the result is true, the only time we know anything is if
// OP2 is a constant.
- if (op2.singleton_p ())
+ else if (op2.singleton_p ())
{
// This is correct even if op1 is NAN, because the following
// range would be ~[tmp, tmp] with the NAN property set to