https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85549
--- Comment #4 from Martin Jambor <jamborm at gcc dot gnu.org> --- This is another stupid omission, I forgot that for by-reference aggregate values, one has to check the agg_preserved of the jump function. diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 1b8f335fd32..4f28a55b862 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -4372,7 +4372,9 @@ find_aggregate_values_for_callers_subset (struct cgraph_node *node, { struct ipa_jump_func *jfunc = ipa_get_ith_jump_func (IPA_EDGE_REF (cs), i); - if (self_recursive_pass_through_p (cs, jfunc, i)) + if (self_recursive_pass_through_p (cs, jfunc, i) + && (!plats->aggs_by_ref + || ipa_get_jf_pass_through_agg_preserved (jfunc))) continue; inter = intersect_aggregates_with_edge (cs, i, inter);