Do not ICE in IPA inliner.
authorMartin Liska <mliska@suse.cz>
Wed, 23 Oct 2019 08:55:05 +0000 (10:55 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Wed, 23 Oct 2019 08:55:05 +0000 (08:55 +0000)
2019-10-23  Martin Liska  <mliska@suse.cz>

PR ipa/91969
* ipa-inline.c (recursive_inlining): Do not print
when curr->count is not initialized.
2019-10-23  Martin Liska  <mliska@suse.cz>

PR ipa/91969
* g++.dg/ipa/pr91969.C: New test.

From-SVN: r277309

gcc/ChangeLog
gcc/ipa-inline.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ipa/pr91969.C [new file with mode: 0644]

index 2445523..85cd7a0 100644 (file)
@@ -1,3 +1,9 @@
+2019-10-23  Martin Liska  <mliska@suse.cz>
+
+       PR ipa/91969
+       * ipa-inline.c (recursive_inlining): Do not print
+       when curr->count is not initialized.
+
 2019-10-23  Richard Biener  <rguenther@suse.de>
 
        * tree-vect-slp.c (vect_build_slp_tree_2): Do not build
index 681801a..ce146e0 100644 (file)
@@ -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 ()
index fd27280..482ff0c 100644 (file)
@@ -1,3 +1,8 @@
+2019-10-23  Martin Liska  <mliska@suse.cz>
+
+       PR ipa/91969
+       * g++.dg/ipa/pr91969.C: New test.
+
 2019-10-22  Marc Glisse  <marc.glisse@inria.fr>
 
        PR c++/85746
diff --git a/gcc/testsuite/g++.dg/ipa/pr91969.C b/gcc/testsuite/g++.dg/ipa/pr91969.C
new file mode 100644 (file)
index 0000000..9000672
--- /dev/null
@@ -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 (...) {}
+};