Hi, PR 55260 contains two testcases which trigger two different bugs in ipa-cp.c. The first problem is that at one place in find_aggregate_values_for_callers_subset we use variable info instead of caller_info when determining whether a callee is a clone which then leads to an ICE. Fixed thusly and I also renamed info to dest_info to make similar mistakes harder to make in future.
Fix of the second PR 55260 bug will probably involve some fiddling with vectors so I'll submit it next week when the new interface is in place. Bootstrapped and tested on x86_64-linux, OK for trunk? Thanks, Martin 2012-11-16 Martin Jambor <mjam...@suse.cz> PR tree-optimization/55260 * ipa-cp.c (find_aggregate_values_for_callers_subset): Rename info to dest_info, use caller_info instead of info when determining whether callee is a clone. * testsuite/g++.dg/torture/pr55260-1.C: New test. Index: src/gcc/testsuite/g++.dg/torture/pr55260-1.C =================================================================== --- /dev/null +++ src/gcc/testsuite/g++.dg/torture/pr55260-1.C @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-std=gnu++0x -fno-inline" } */ +/* { dg-add-options bind_pic_locally } */ + + struct B + { + constexpr B (): + bp () + {} + ~B () + { + if (bp) + bp->f (); + } + void f (); + B *bp; + }; +struct A { B b; +}; + +void foo () +{ + A a; +} Index: src/gcc/ipa-cp.c =================================================================== --- src.orig/gcc/ipa-cp.c +++ src/gcc/ipa-cp.c @@ -2870,10 +2870,10 @@ static struct ipa_agg_replacement_value find_aggregate_values_for_callers_subset (struct cgraph_node *node, VEC (cgraph_edge_p,heap) *callers) { - struct ipa_node_params *info = IPA_NODE_REF (node); + struct ipa_node_params *dest_info = IPA_NODE_REF (node); struct ipa_agg_replacement_value *res = NULL; struct cgraph_edge *cs; - int i, j, count = ipa_get_param_count (info); + int i, j, count = ipa_get_param_count (dest_info); FOR_EACH_VEC_ELT (cgraph_edge_p, callers, j, cs) { @@ -2891,7 +2891,7 @@ find_aggregate_values_for_callers_subset /* Among other things, the following check should deal with all by_ref mismatches. */ - if (ipa_get_parm_lattices (info, i)->aggs_bottom) + if (ipa_get_parm_lattices (dest_info, i)->aggs_bottom) continue; FOR_EACH_VEC_ELT (cgraph_edge_p, callers, j, cs) @@ -2943,7 +2943,7 @@ find_aggregate_values_for_callers_subset struct ipcp_param_lattices *src_plats; HOST_WIDE_INT delta = ipa_get_jf_ancestor_offset (jfunc); - if (info->ipcp_orig_node) + if (caller_info->ipcp_orig_node) { if (!inter) inter = agg_replacements_to_vector (cs->caller, delta);