https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91137
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Richard Biener from comment #3) > I think the issue is > > inv_expr 5: ((signed long) &d + 19600) - (signed long) &c > > I hope Bin can investigate this. In the end we can only fight the RTL > alias analysis issue with heuristics here though... > > We're fearing compile-time issues from a fix like the following, but > ultimatively find_base_term is known broken for a _looooong_ time. Note the patch is only extra heuristics since a correct fix would be conservatively determining whether any argument contains a base value. See PR49330 for all the glory details. > Index: gcc/alias.c > =================================================================== > --- gcc/alias.c (revision 273355) > +++ gcc/alias.c (working copy) > @@ -2003,16 +2003,20 @@ find_base_term (rtx x, vec<std::pair<cse > term is from a pointer or is a named object or a special address > (like an argument or stack reference), then use it for the > base term. */ > - rtx base = find_base_term (tmp1, visited_vals); > - if (base != NULL_RTX > - && ((REG_P (tmp1) && REG_POINTER (tmp1)) > - || known_base_value_p (base))) > - return base; > - base = find_base_term (tmp2, visited_vals); > - if (base != NULL_RTX > - && ((REG_P (tmp2) && REG_POINTER (tmp2)) > - || known_base_value_p (base))) > - return base; > + rtx base1 = find_base_term (tmp1, visited_vals); > + if (!(base1 != NULL_RTX > + && ((REG_P (tmp1) && REG_POINTER (tmp1)) > + || known_base_value_p (base1)))) > + base1 = NULL_RTX; > + rtx base2 = find_base_term (tmp2, visited_vals); > + if (!(base2 != NULL_RTX > + && ((REG_P (tmp2) && REG_POINTER (tmp2)) > + || known_base_value_p (base2)))) > + base2 = NULL_RTX; > + if (base1 && !base2) > + return base1; > + if (!base1 && base2) > + return base2; > > /* We could not determine which of the two operands was the > base register and which was the index. So we can determine