https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64601
--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> --- (In reply to Richard Biener from comment #1) > It's indeed that GCC only sees int accesses based on w and v and thus has to > consider they might alias. > > TBAA cannot be strengthened easily here because the stores change the > dynamic type of the memory. struct A { int i; }; inline void z(int*i){*i=0;} void f(struct A *a){ a->i=0; } void g(struct A *a){ z(&a->i); } f uses a_2(D)->i g uses MEM[(int *)a_1(D)] (folded from *_2 where _2 = &a_1(D)->i) Is it really true that we can't treat g the same as f? That sounds quite bad to me. Or a version without stores: struct A { int i; }; inline int z(int*i){return*i;} int f(struct A *a){ return a->i; } int g(struct A *a){ return z(&a->i); } still has a_2(D)->i in f and MEM[(int *)a_1(D)] in g. I don't think Jonathan and Paolo will be happy if I send a patch hand-inlining std::swap in various places in libstdc++ :-(