On Tue, Dec 17, 2019 at 01:50:32PM +0100, Martin Jambor wrote: > Hi, > > as reported in PR 92971, IPA-CP's > cgraph_edge_brings_all_agg_vals_for_node defines one local variable with > the static keyword which is a clear mistake, probabley a cut'n'paste > error when I originally wrote the code. > > I'll commit the following as obvious after a round of bootstrap and > testing. Early next year, I'll also commit it to all opened release > branches.
Is that what you want to do though? Because when it is an automatic variable (shouldn't it be auto_vec, btw), then the first use of it doesn't make much sense: values = intersect_aggregates_with_edge (cs, i, values); because it will be always (cs, i, vNULL). So maybe the var should live across the iterations or live in the caller that should pass a pointer (or reference) to it? With the patch, there will be leaks too, because the values vector is only released if the function returns false and is not released otherwise. > 2019-12-17 Martin Jambor <mjam...@suse.cz> > > * ipa-cp.c (cgraph_edge_brings_all_agg_vals_for_node): Remove > static from local variable definition. > --- > gcc/ipa-cp.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c > index 1a80ccbde2d..6692eb7b878 100644 > --- a/gcc/ipa-cp.c > +++ b/gcc/ipa-cp.c > @@ -5117,7 +5117,7 @@ cgraph_edge_brings_all_agg_vals_for_node (struct > cgraph_edge *cs, > > for (i = 0; i < count; i++) > { > - static vec<ipa_agg_value> values = vNULL; > + vec<ipa_agg_value> values = vNULL; > class ipcp_param_lattices *plats; > bool interesting = false; > for (struct ipa_agg_replacement_value *av = aggval; av; av = av->next) > -- > 2.24.0 Jakub