From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2136) id 1CE1C394880F; Mon, 10 Oct 2022 12:50:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1CE1C394880F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665406254; bh=ukhb/Fxch6/ac7+G+Uf2bv8MBOEPn/xMyE90wgu8ZZA=; h=From:To:Subject:Date:From; b=KsyKNsfwjEd86wn4ChjYY1Xw2aoI1H7V056nkqT+lCphvct5ZBo5F6dlDYeHw404C e+WLXthiSjxSJABtpK79QO6dPbK0BGgCCd5aTAujI9M0BH1tDOeKK9neIUqFHupW9Z gjTnLbKqiu8XRVvjQxRSIZzcxea83SHQ1Wo2+GT4= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Aldy Hernandez To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3195] The true side of x != x should set NAN. X-Act-Checkin: gcc X-Git-Author: Aldy Hernandez X-Git-Refname: refs/heads/master X-Git-Oldrev: 58fa21622b01d6064024c92bb09fb60fa5b75977 X-Git-Newrev: 69988cd58becc115b236f88627fe92436baaa674 Message-Id: <20221010125054.1CE1C394880F@sourceware.org> Date: Mon, 10 Oct 2022 12:50:54 +0000 (GMT) List-Id: https://gcc.gnu.org/g:69988cd58becc115b236f88627fe92436baaa674 commit r13-3195-g69988cd58becc115b236f88627fe92436baaa674 Author: Aldy Hernandez Date: Mon Oct 10 11:15:43 2022 +0200 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. Diff: --- gcc/range-op-float.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index 91833d3f855..5ffe38da53a 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