https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124661
--- Comment #9 from Christopher Albert <albert at tugraz dot at> --- You are right, the saved_prior_ref guard is not needed with unshare_expr -- it was left over from an earlier iteration before I added the unsharing. Your alternative approach with find_tree on the preliminary code is cleaner since it targets exactly the shared subtrees rather than copying everything upfront. Feel free to use the testcase from my patch if it helps -- it covers both the original case and the nested component-array variant from comment #4.
