https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61502
--- Comment #38 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Alexander Cherepanov from comment #37) > On 30/12/2019 10.51, rguenther at suse dot de wrote: > >> Obviously, it could be used to fold `a + i == b` to `0` if `a` and `b` > >> are two different known arrays and `i` is unknown > > > > That's indeed the main thing. Basically it allows points-to analysis work at > > all in the presence of non-constant offsets. > > But what is PTA used for? Examples that I've seen all deal with > dereferenceable pointers. And current gcc behaviour is just fine in that > case. The problem is with non-dereferenceable pointers. So is PTA important > for cases where dereferenceability is unknown (or known to be false) or it's > just too complicated to take dereferenceability into account? points-to analysis doesn't care about whether a pointer is dereferenced or not when computing its points-to set. You can very well add a dereference to your testcase and that shouldn't affect its outcome, no? And yes, GCC uses points-to analysis results to optimize pointer equality compares like p == q to false if the points-to sets do not intersect (for a set of cases, but that's current implementation detail). That helps surprisingly often for abstraction coming from the C++ standard library container iterators. I do agree that we have bugs in GCC but AFAICS those come from conditional equivalences being propagated and from the very old RTL alias analysis issue involving base_alias_check. Once we dealt with the latter I'm happily exploring fixes for the former - but the latter will happily nullify fixes of the former.