https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82899
--- Comment #14 from Marc Glisse <glisse at gcc dot gnu.org> --- (In reply to Marc Glisse from comment #13) > I have no idea what was changed in gcc-8 that > helped the original testcase, (optimization happens in FRE1) It could be an optimization that says that either the objects don't alias and we are writing _1, or they are the same object and we are writing _1, so just write _1 without caring about aliasing. This was definitely discussed, but I didn't remember that it had been committed (bug 80617 is still open). Anyway, if you want to experiment, the function build_this_parm (in gcc/cp/decl.c) seems like a good starting point.