From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2136) id B64E63858404; Wed, 19 Oct 2022 21:16:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B64E63858404 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666214178; bh=d+ubr5KNxpQb37wY35D2QWlKPvS3QpjEadpdVLrTFKE=; h=From:To:Subject:Date:From; b=k5FM04jp06wMbBM7THKPCEIYM+pcIblGw2XQhvTKhbRPOcx5jKE/nBGfHkw0WonJd ruSWo2KaPb3t/XD2dAvtDKocuXRHYKUAw3R3W0tqyr4RRtVs+zfzNDyN5kPjLBPOc8 zFP0XdLbQX5pEqWa76FClsBnxvXfRNlUuklykRfE= 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-3391] Always check result from build_ in range-op-float.cc X-Act-Checkin: gcc X-Git-Author: Aldy Hernandez X-Git-Refname: refs/heads/master X-Git-Oldrev: ebe87edadc4a3f15a6a0d0c1d4a198e0ea37d8b5 X-Git-Newrev: f0068278f7e75507c1f40e7c829d7a9d6ade269c Message-Id: <20221019211618.B64E63858404@sourceware.org> Date: Wed, 19 Oct 2022 21:16:18 +0000 (GMT) List-Id: https://gcc.gnu.org/g:f0068278f7e75507c1f40e7c829d7a9d6ade269c commit r13-3391-gf0068278f7e75507c1f40e7c829d7a9d6ade269c Author: Aldy Hernandez Date: Wed Oct 19 17:05:39 2022 +0200 Always check result from build_ in range-op-float.cc A result of false from build_ in range-ops means the result is final and needs no further adjustments. This patch documents this, and changes all uses to check the result. There should be no change in functionality. gcc/ChangeLog: * range-op-float.cc (build_le): Document result. (build_lt): Same. (build_ge): Same. (foperator_ge::op2_range): Check result of build_*. (foperator_unordered_le::op1_range): Same. (foperator_unordered_le::op2_range): Same. (foperator_unordered_gt::op1_range): Same. (foperator_unordered_gt::op2_range): Same. (foperator_unordered_ge::op1_range): Same. (foperator_unordered_ge::op2_range): Same. Diff: --- gcc/range-op-float.cc | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index e7334794b0d..0605a908684 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -239,7 +239,9 @@ frange_add_zeros (frange &r, tree type) } } -// Build a range that is <= VAL and store it in R. +// Build a range that is <= VAL and store it in R. Return TRUE if +// further changes may be needed for R, or FALSE if R is in its final +// form. static bool build_le (frange &r, tree type, const frange &val) @@ -255,7 +257,9 @@ build_le (frange &r, tree type, const frange &val) return true; } -// Build a range that is < VAL and store it in R. +// Build a range that is < VAL and store it in R. Return TRUE if +// further changes may be needed for R, or FALSE if R is in its final +// form. static bool build_lt (frange &r, tree type, const frange &val) @@ -277,7 +281,9 @@ build_lt (frange &r, tree type, const frange &val) return true; } -// Build a range that is >= VAL and store it in R. +// Build a range that is >= VAL and store it in R. Return TRUE if +// further changes may be needed for R, or FALSE if R is in its final +// form. static bool build_ge (frange &r, tree type, const frange &val) @@ -293,7 +299,9 @@ build_ge (frange &r, tree type, const frange &val) return true; } -// Build a range that is > VAL and store it in R. +// Build a range that is > VAL and store it in R. Return TRUE if +// further changes may be needed for R, or FALSE if R is in its final +// form. static bool build_gt (frange &r, tree type, const frange &val) @@ -979,11 +987,8 @@ foperator_ge::op2_range (frange &r, tree type, // The TRUE side of NAN >= x is unreachable. if (op1.known_isnan ()) r.set_undefined (); - else - { - build_le (r, type, op1); - r.clear_nan (); - } + else if (build_le (r, type, op1)) + r.clear_nan (); break; case BRS_FALSE: @@ -1354,8 +1359,8 @@ foperator_unordered_le::op1_range (frange &r, tree type, break; case BRS_FALSE: - build_gt (r, type, op2); - r.clear_nan (); + if (build_gt (r, type, op2)) + r.clear_nan (); break; default: @@ -1378,8 +1383,8 @@ foperator_unordered_le::op2_range (frange &r, break; case BRS_FALSE: - build_lt (r, type, op1); - r.clear_nan (); + if (build_lt (r, type, op1)) + r.clear_nan (); break; default: @@ -1437,8 +1442,8 @@ foperator_unordered_gt::op1_range (frange &r, break; case BRS_FALSE: - build_le (r, type, op2); - r.clear_nan (); + if (build_le (r, type, op2)) + r.clear_nan (); break; default: @@ -1461,8 +1466,8 @@ foperator_unordered_gt::op2_range (frange &r, break; case BRS_FALSE: - build_ge (r, type, op1); - r.clear_nan (); + if (build_ge (r, type, op1)) + r.clear_nan (); break; default: @@ -1520,8 +1525,8 @@ foperator_unordered_ge::op1_range (frange &r, break; case BRS_FALSE: - build_lt (r, type, op2); - r.clear_nan (); + if (build_lt (r, type, op2)) + r.clear_nan (); break; default: @@ -1543,8 +1548,8 @@ foperator_unordered_ge::op2_range (frange &r, tree type, break; case BRS_FALSE: - build_gt (r, type, op1); - r.clear_nan (); + if (build_gt (r, type, op1)) + r.clear_nan (); break; default: