https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102581
--- Comment #7 from Jan Hubicka <hubicka at ucw dot cz> --- Hi, the problem is that we assume that merge is symmetric (merging a to b succeeds if and only if merging b to a succeeds). There was one symetrical path missing in the (fancy and bit ugly) logic on what we can merge losslessly. I also added sanity check for this assumption. So bugs like this should fire more often. Honza diff --git a/gcc/ipa-modref-tree.h b/gcc/ipa-modref-tree.h index 6a9ed5ce54b..61b4b16dbed 100644 --- a/gcc/ipa-modref-tree.h +++ b/gcc/ipa-modref-tree.h @@ -234,6 +234,17 @@ struct GTY(()) modref_access_node record_adjustments); return true; } + if (known_size_p (a.size) + && (!known_size_p (size) || known_lt (size, a.size))) + { + if (((known_size_p (max_size) || known_size_p (a.max_size)) + && !known_eq (max_size, a.max_size)) + || !known_eq (offset1, aoffset1)) + return false; + update (new_parm_offset, offset1, size, max_size, + record_adjustments); + return true; + } /* If sizes are same, we can extend the interval. */ if ((known_size_p (size) || known_size_p (a.size)) && !known_eq (size, a.size)) @@ -618,6 +629,7 @@ private: found = true; if (!found && n->merge (*a, false)) found = restart = true; + gcc_checking_assert (found || !a->merge (*n, false)); if (found) { accesses->unordered_remove (i);