https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70847
--- Comment #11 from Patrick Palka <ppalka at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #10) > Note, the patch has been successfully bootstrapped/regtested on x86_64-linux > and i686-linux. > > I don't think such shared trees should be occurring significantly that it > would matter. > But, if you want to handle those, your change makes no sense, because if > cp_fold returns something other than its argument unmodified, then the > subsequent subtree walking happens on the new tree, not the old one, but you > stop the walking of the subtrees the second time. But that's ok since the walking of the subtrees doesn't have to be done a second time. That's because the 2nd call to cp_fold (on the original shared tree) will return the same tree as the 1st call to cp_fold (because of the fold_cache). That returned tree will already have had its subtrees folded the first time around. I think..