From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id A46DE3858D20; Wed, 9 Nov 2022 12:08:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A46DE3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667995727; bh=hJkJZRDEXGHpA0WGcP4zn+x2ameuTQoBTkmlZJnEstQ=; h=From:To:Subject:Date:From; b=cDnYQq1X7hCKN4U+u2NmZkR8b3b/Ec95qVpuuV3ydLEZfLH6GYZ1C03RBnZQKca2z wq+1XD/HBpMU239jy9S9J0swjt0+FokOHQxNFZiCjRlqBjwXTCyn7R2XqYCmhjaelU WLYinBawkalR8CGlk4FIXbw7XrjOW5hNL5LVbFLg= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3852] Fix up foperator_abs::op1_range [PR107569] X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/master X-Git-Oldrev: d05a423c1e7b81021a1b6bee93db31a903d87667 X-Git-Newrev: d943927ff860cea44a9cf64fc6d591a4a6e37f6f Message-Id: <20221109120847.A46DE3858D20@sourceware.org> Date: Wed, 9 Nov 2022 12:08:47 +0000 (GMT) List-Id: https://gcc.gnu.org/g:d943927ff860cea44a9cf64fc6d591a4a6e37f6f commit r13-3852-gd943927ff860cea44a9cf64fc6d591a4a6e37f6f Author: Jakub Jelinek Date: Wed Nov 9 13:07:32 2022 +0100 Fix up foperator_abs::op1_range [PR107569] foperator_abs::op1_range works except for the NaN handling, from: [frange] double [-Inf, 1.79769313486231570814527423731704356798070567525844996599e+308 (0x0.fffffffffffff8p+1024)] lhs it computes r [frange] double [-1.79769313486231570814527423731704356798070567525844996599e+308 (-0x0.fffffffffffff8p+1024), 1.79769313486231570814527423731704356798070567525844996599e+308 +(0x0.fffffffffffff8p+1024)] +-NAN which is correct except for the +-NAN part. For r before the final step it makes sure to add -NAN if there is +NAN in the lhs range, but the final r.union_ makes it unconditional +-NAN, because the frange ctor sets +-NAN. So, I think we need to clear it (or have some set variant which says not to set NAN). This patch fixes that, but isn't enough to fix the PR, something in the assumptions handling is still broken (and the PR has other parts). 2022-11-09 Jakub Jelinek PR tree-optimization/107569 * range-op-float.cc (foperator_abs::op1_range): Clear NaNs from the negatives frange before unioning it into r. Diff: --- gcc/range-op-float.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index 44db81c1c1e..cc806438a19 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -1394,9 +1394,10 @@ foperator_abs::op1_range (frange &r, tree type, return true; // Then add the negative of each pair: // ABS(op1) = [5,20] would yield op1 => [-20,-5][5,20]. - r.union_ (frange (type, - real_value_negate (&positives.upper_bound ()), - real_value_negate (&positives.lower_bound ()))); + frange negatives (type, real_value_negate (&positives.upper_bound ()), + real_value_negate (&positives.lower_bound ())); + negatives.clear_nan (); + r.union_ (negatives); return true; }