https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89317
--- Comment #12 from rguenther at suse dot de <rguenther at suse dot de> --- On Sun, 11 Dec 2022, glisse at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89317 > > --- Comment #11 from Marc Glisse <glisse at gcc dot gnu.org> --- > (In reply to Richard Biener from comment #10) > > Should be fixed in GCC 13. > > If I compile the original testcase with -O3, I get for test2: > > _1 = this_6(D) + 16; > _2 = &this_6(D)->data1; > if (_1 != _2) > > so we should probably also handle comparisons and not just subtractions. For > this particular testcase, the relevant optimizations still happen and RTL > cleans up the comparison, so it is ok, but the pattern appears in other PRs > like PR 106677. I'll see to add those.