Hi. I'm sending patch for the PR, unfortunately I've back-ported Honza's patch that introduced the regression to GCC 5.3.
Fix is obvious, I've been running regression tests for both trunk and gcc-5-branch. Identical patch can be applied (modulo a line with 'cleanup-ipa-dump'). Ready after it finishes? Thanks, Martin
>From 9f547d06489ffd85b20b09067b4cfbca2c0ff70e Mon Sep 17 00:00:00 2001 From: marxin <mli...@suse.cz> Date: Tue, 8 Dec 2015 18:46:44 +0100 Subject: [PATCH] Fix PR ipa/68790 gcc/ChangeLog: 2015-12-08 Martin Liska <mli...@suse.cz> PR ipa/68790 * ipa-icf.c (sem_function::param_used_p): Return true if ipa_node_params_sum equals to NULL. gcc/testsuite/ChangeLog: 2015-12-08 Martin Liska <mli...@suse.cz> * gcc.dg/ipa/pr68790.c: New test. --- gcc/ipa-icf.c | 2 +- gcc/testsuite/gcc.dg/ipa/pr68790.c | 40 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/ipa/pr68790.c diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c index 0029a48..889a07d 100644 --- a/gcc/ipa-icf.c +++ b/gcc/ipa-icf.c @@ -544,7 +544,7 @@ bool sem_function::param_used_p (unsigned int i) { if (ipa_node_params_sum == NULL) - return false; + return true; struct ipa_node_params *parms_info = IPA_NODE_REF (get_node ()); diff --git a/gcc/testsuite/gcc.dg/ipa/pr68790.c b/gcc/testsuite/gcc.dg/ipa/pr68790.c new file mode 100644 index 0000000..258c004 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/pr68790.c @@ -0,0 +1,40 @@ +/* { dg-do run } */ +/* { dg-options "-O0 -fipa-icf -fdump-ipa-icf" } */ + +struct S +{ + int a; +}; + +int +foo3 (struct S x, struct S y, struct S z) +{ + if (z.a != 9) + __builtin_abort (); + return 0; +} + +int +bar3 (struct S x, struct S y, struct S z) +{ + return foo3 (y, x, z); +} + +int +baz3 (struct S x, struct S y, struct S z) +{ + return foo3 (y, z, x); +} + +int +main (void) +{ + struct S + a = { 3 }, + b = { 6 }, + c = { 9 }; + + return bar3 (b, a, c); +} + +/* { dg-final { scan-ipa-dump "Equal symbols: 0" "icf" } } */ -- 2.6.3