https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124608

--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> ---
diff --git a/gcc/ipa-modref-tree.cc b/gcc/ipa-modref-tree.cc
index 5d91dc44241..018cf1fb924 100644
--- a/gcc/ipa-modref-tree.cc
+++ b/gcc/ipa-modref-tree.cc
@@ -97,10 +97,13 @@ modref_access_node::contains (const modref_access_node &a)
const
              || !known_le (size, a.size)))
        return false;
       if (known_size_p (max_size))
+      {
+             gcc_assert (known_size_p (a.max_size));
        return known_subrange_p (poly_offset_int::from (a.offset, SIGNED)
                                 + aoffset_adj, a.max_size,
                                 poly_offset_int::from (offset, SIGNED),
                                 max_size);
+      }
       else
        return known_le (poly_offset_int::from (offset, SIGNED),
                         poly_offset_int::from (a.offset, SIGNED)

indeed ICEs quickly.  This case is at the moment handled as return false.
But !known_size_p (max_size) && known_size_p (a.max_size) can be either
true or false from the known_le case.

Only Honza can tell whether any particular behavior was intended here,
but I second-guess from the previous check on size that
[A, fixed-size] vs. [B, unknown-size] with A < B is not "more general",
but neither is the other access, but [A, unknown-size] would be, so I
assume that when returning false we merge both accesses.  So the current
behavior might be correct after all.

Reply via email to