Hi. We should not call to_gcov_type on a count that is uninitialized. That's the case for a THUNK cgraph_node that we inline.
Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin gcc/ChangeLog: 2019-10-22 Martin Liska <mli...@suse.cz> PR ipa/91969 * ipa-inline.c (recursive_inlining): Do not print when curr->count is not initialized. gcc/testsuite/ChangeLog: 2019-10-22 Martin Liska <mli...@suse.cz> PR ipa/91969 * g++.dg/ipa/pr91969.C: New test. --- gcc/ipa-inline.c | 2 +- gcc/testsuite/g++.dg/ipa/pr91969.C | 38 ++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/ipa/pr91969.C
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 681801a9aec..ce146e0fc07 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -1610,7 +1610,7 @@ recursive_inlining (struct cgraph_edge *edge, { fprintf (dump_file, " Inlining call of depth %i", depth); - if (node->count.nonzero_p ()) + if (node->count.nonzero_p () && curr->count.initialized_p ()) { fprintf (dump_file, " called approx. %.2f times per call", (double)curr->count.to_gcov_type () diff --git a/gcc/testsuite/g++.dg/ipa/pr91969.C b/gcc/testsuite/g++.dg/ipa/pr91969.C new file mode 100644 index 00000000000..90006720f1d --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr91969.C @@ -0,0 +1,38 @@ +/* PR ipa/91969 */ +/* { dg-options "-fdump-ipa-inline -O3" } */ + +enum by +{ +}; +class A +{ +public: + class B + { + public: + virtual void m_fn2 (by) = 0; + }; + virtual int m_fn1 (); + B *cf; +}; +by a; +class C : A, A::B +{ + void m_fn2 (by); +}; +void C::m_fn2 (by) { cf->m_fn2 (a); } + +struct a +{ + virtual ~a (); +}; + +struct b +{ + virtual void d (...); +}; + +struct c : a, b +{ + void d (...) {} +};