From 94a2f772f041cdbc3711aa8b7da8678fb206fa36 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Tue, 10 Feb 2015 01:38:46 +0100 Subject: [PATCH] re PR ipa/64978 (ICE: in ipcp_verify_propagated_values, at ipa-cp.c:1060) PR ipa/64978 * ipa-cp.c (gather_caller_stats): Skip thunks. (propagate_constants_topo): Skip aliases. * g++.dg/torture/pr64978.C: New testcase. From-SVN: r220557 --- gcc/ChangeLog | 6 ++++++ gcc/ipa-cp.c | 7 ++---- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/torture/pr64978.C | 30 ++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/g++.dg/torture/pr64978.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5981be87a1d..47574709f40 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-02-09 Jan Hubicka + + PR ipa/64978 + * ipa-cp.c (gather_caller_stats): Skip thunks. + (propagate_constants_topo): Skip aliases. + 2015-02-09 Kaz Kojima PR target/64761 diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 0c540eb61c7..440ced4900c 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -560,10 +560,7 @@ gather_caller_stats (struct cgraph_node *node, void *data) struct cgraph_edge *cs; for (cs = node->callers; cs; cs = cs->next_caller) - if (cs->caller->thunk.thunk_p) - cs->caller->call_for_symbol_thunks_and_aliases (gather_caller_stats, - stats, false); - else + if (!cs->caller->thunk.thunk_p) { stats->count_sum += cs->count; stats->freq_sum += cs->frequency; @@ -2643,7 +2640,7 @@ propagate_constants_topo (struct ipa_topo_info *topo) for (cs = v->callees; cs; cs = cs->next_callee) if (ipa_edge_within_scc (cs) && propagate_constants_accross_call (cs)) - push_node_to_stack (topo, cs->callee); + push_node_to_stack (topo, cs->callee->function_symbol ()); v = pop_node_from_stack (topo); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 67f1e8e5355..f34de6ed35d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-02-08 Jan Hubicka + + PR ipa/64978 + * g++.dg/torture/pr64978.C: New testcase. + 2015-02-09 Jakub Jelinek PR sanitizer/64981 diff --git a/gcc/testsuite/g++.dg/torture/pr64978.C b/gcc/testsuite/g++.dg/torture/pr64978.C new file mode 100644 index 00000000000..a9ac49f8e12 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr64978.C @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +class A { +public: + A(int, int); +}; +class B { +public: + void m_fn1(bool, const int *, int &); + unsigned m_fn2(); +}; +namespace { +class C { + B &VTables; + void m_fn3(A, unsigned, const int *, int &); + +public: + int VFTableBuilder_VisitedBases; + B VFTableBuilder_VTables; + C() : VTables(VFTableBuilder_VTables) { + m_fn3(A(0, 0), 0, 0, VFTableBuilder_VisitedBases); + } +}; +} +int a; +void C::m_fn3(A, unsigned, const int *, int &) { + for (;;) + 1 ? VTables.m_fn2() : 0; +} +void B::m_fn1(bool, const int *, int &) { C(); } +unsigned B::m_fn2() { m_fn1(0, 0, a); } -- 2.30.2