public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-3593] Intersect with nonzero bits can indicate change incorrectly.
@ 2022-11-01 13:19 Andrew Macleod
  0 siblings, 0 replies; only message in thread
From: Andrew Macleod @ 2022-11-01 13:19 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:7cc2824e39440dd71a9d2832c51ef260bb36d8ca

commit r13-3593-g7cc2824e39440dd71a9d2832c51ef260bb36d8ca
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Mon Oct 31 09:53:01 2022 -0400

    Intersect with nonzero bits can indicate change incorrectly.
    
            * value-range.cc (irange::intersect_nonzero_bits): If new
            non-zero mask is the same as original, flag no change.

Diff:
---
 gcc/value-range.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index 03b3c4b4a65..3743ec714b3 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -3017,6 +3017,10 @@ irange::intersect_nonzero_bits (const irange &r)
   if (mask_to_wi (m_nonzero_mask, t) != mask_to_wi (r.m_nonzero_mask, t))
     {
       wide_int nz = get_nonzero_bits () & r.get_nonzero_bits ();
+      // If the nonzero bits did not change, return false.
+      if (nz == get_nonzero_bits ())
+	return false;
+
       m_nonzero_mask = wide_int_to_tree (t, nz);
       if (set_range_from_nonzero_bits ())
 	return true;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-01 13:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-01 13:19 [gcc r13-3593] Intersect with nonzero bits can indicate change incorrectly Andrew Macleod

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).