]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
intersect_bitmask - Always update bitmask.
authorAndrew MacLeod <amacleod@redhat.com>
Thu, 12 Jun 2025 18:48:50 +0000 (14:48 -0400)
committerAndrew MacLeod <amacleod@redhat.com>
Wed, 18 Jun 2025 17:49:22 +0000 (13:49 -0400)
The bitmask wasn't always being updated, resulting in some less than
perfect masks being stored.:x

* value-range.cc (irange::intersect_bitmask): Always update the
stored mask to reflect the current calculated mask.

gcc/value-range.cc

index 348c68ec902e348f35594b0646b6a765da171a72..0f0770ad7051f488c26b5573778b74d50fdfa891 100644 (file)
@@ -2548,15 +2548,14 @@ irange::intersect_bitmask (const irange &r)
   irange_bitmask bm = get_bitmask ();
   irange_bitmask save = bm;
   bm.intersect (r.get_bitmask ());
-  if (save == bm)
-    return false;
-
+  // Use ths opportunity to make sure mask reflects always reflects the
+  // best mask we have.
   m_bitmask = bm;
 
   // Updating m_bitmask may still yield a semantic bitmask (as
   // returned by get_bitmask) which is functionally equivalent to what
   // we originally had.  In which case, there's still no change.
-  if (save == get_bitmask ())
+  if (save == bm || save == get_bitmask ())
     return false;
 
   if (!set_range_from_bitmask ())