From 12cc8c723ed0dccdbb6b2b590706b1344d468c55 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 31 Mar 2015 18:03:03 +0200 Subject: [PATCH] re PR ipa/65557 (ICE: SIGSEGV in hash_table<>::find_slot_with_hash() with -fdevirtualize -fipa-cp -fipa-icf-functions) Fix PR65557. * ipa-icf.c (sem_function::equals_wpa): Check if IPA CP has already filled up function summary. (sem_item_optimizer::update_hash_by_addr_refs): Likewise. * g++.dg/ipa/pr65557.C: New test. From-SVN: r221796 --- gcc/ChangeLog | 7 +++++++ gcc/ipa-icf.c | 4 ++-- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/ipa/pr65557.C | 19 +++++++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ipa/pr65557.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e37abf98162..150525b7ba9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-03-31 Martin Liska + + PR ipa/65557 + * ipa-icf.c (sem_function::equals_wpa): Check if IPA CP + has already filled up function summary. + (sem_item_optimizer::update_hash_by_addr_refs): Likewise. + 2015-03-31 Richard Biener * tree-sra.c (create_access_replacement): Drop under-/over-alignment diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c index ad868e10c04..8626730dca8 100644 --- a/gcc/ipa-icf.c +++ b/gcc/ipa-icf.c @@ -534,7 +534,7 @@ sem_function::equals_wpa (sem_item *item, if (opt_for_fn (decl, flag_devirtualize) && (TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE || TREE_CODE (TREE_TYPE (item->decl)) == METHOD_TYPE) - && (!flag_ipa_cp + && (ipa_node_params_sum == NULL || ipa_is_param_used (IPA_NODE_REF (dyn_cast (node)), 0)) && compare_polymorphic_p ()) @@ -2505,7 +2505,7 @@ sem_item_optimizer::update_hash_by_addr_refs () && contains_polymorphic_type_p (method_class_type (TREE_TYPE (m_items[i]->decl))) && (DECL_CXX_CONSTRUCTOR_P (m_items[i]->decl) - || ((!flag_ipa_cp + || ((ipa_node_params_sum == NULL || ipa_is_param_used ( IPA_NODE_REF (dyn_cast (m_items[i]->node)), 0)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b6236369291..5d0d3b4f73f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-03-31 Martin Liska + + * g++.dg/ipa/pr65557.C: New test. + 2015-03-31 Dominik Vogt * gcc.target/s390/hotpatch-25.c: New test. diff --git a/gcc/testsuite/g++.dg/ipa/pr65557.C b/gcc/testsuite/g++.dg/ipa/pr65557.C new file mode 100644 index 00000000000..2250bb079b0 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr65557.C @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-ipa-icf-details" } */ + +struct S0 +{ + S0 () + { + } +}; + +struct S1 +{ + S1 () + { + } +}; + +S0 s0; +S1 s1; -- 2.30.2