Hi, the patch below makes param_index in ipcp_discover_new_direct_edges an integer. Now it is bool which makes kind of difficult to work with parameters with index 2 or higher, as demonstrated by the testcase.
Bootstrapped and tested on x86_64-linux, approved by Honza in person, I am about to commit it. Thanks, Martin 2014-01-06 Martin Jambor <mjam...@suse.cz> PR ipa/59008 * ipa-cp.c (ipcp_discover_new_direct_edges): Changed param_index type to int. * ipa-inline.c (ipa_inline): Also dump ipa-prop structures in detailed dumps. * ipa-prop.c (ipa_print_node_params): Fix indentation. diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index b484d05..79d066a 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -2281,7 +2281,7 @@ ipcp_discover_new_direct_edges (struct cgraph_node *node, { bool agg_contents = ie->indirect_info->agg_contents; bool polymorphic = ie->indirect_info->polymorphic; - bool param_index = ie->indirect_info->param_index; + int param_index = ie->indirect_info->param_index; struct cgraph_edge *cs = ipa_make_edge_direct_to_target (ie, target); found = true; diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 5a337f7..b12bda4 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -3326,6 +3326,7 @@ ipa_print_node_params (FILE *f, struct cgraph_node *node) { int c; + fprintf (f, " "); ipa_dump_param (f, info, i); if (ipa_is_param_used (info, i)) fprintf (f, " used"); diff --git a/gcc/testsuite/gcc.dg/ipa/pr59008.c b/gcc/testsuite/gcc.dg/ipa/pr59008.c new file mode 100644 index 0000000..b729672 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/pr59008.c @@ -0,0 +1,32 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +typedef int (*funct)(int, int, int); + +extern int f(int, int, int); +extern int g(int, int, int); +extern int h(int, funct, funct); + +static int baz(int x, int y, int z) +{ + return x + y + z; +} + +static int bar(int n, funct f1, funct f2) +{ + return h(n, f1, f2) + f1(0, 1, 2); +} + +static int foo(int n, funct f1, funct f2) +{ + return bar(n, f1, f2) + f2(0, 1, 2); +} + +int main(void) +{ + return foo(0, f, g) +#ifndef ICE2 + + foo(0, baz, g) +#endif + ; +}