]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/62091 (ice in before_dom_children)
authorJason Merrill <jason@redhat.com>
Tue, 19 Aug 2014 18:25:45 +0000 (14:25 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 19 Aug 2014 18:25:45 +0000 (14:25 -0400)
PR tree-optimization/62091
* decl2.c (decl_needed_p): Return true for virtual functions when
devirtualizing.

From-SVN: r214181

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/g++.dg/ipa/devirt-38.C

index c60682e17872e6a8c7e7c48d26efc27634e9d98d..26599c24c3f11ba39cf191a81fadcdd9e5aa8a18 100644 (file)
@@ -1,5 +1,9 @@
 2014-08-19  Jason Merrill  <jason@redhat.com>
 
+       PR tree-optimization/62091
+       * decl2.c (decl_needed_p): Return true for virtual functions when
+       devirtualizing.
+
        PR lto/53808
        PR c++/61659
        * decl.c (maybe_commonize_var): Don't use DECL_COMDAT to trigger
index de28cb712c3aa968b363834ee2ddec1c26b747db..63583a8dc6ae3826b919e6a816ce3c2854ff883b 100644 (file)
@@ -1975,6 +1975,11 @@ decl_needed_p (tree decl)
   if (flag_keep_inline_dllexport
       && lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl)))
     return true;
+  /* Virtual functions might be needed for devirtualization.  */
+  if (flag_devirtualize
+      && TREE_CODE (decl) == FUNCTION_DECL
+      && DECL_VIRTUAL_P (decl))
+    return true;
   /* Otherwise, DECL does not need to be emitted -- yet.  A subsequent
      reference to DECL might cause it to be emitted later.  */
   return false;
index be8cbdfa563b2981f015ece6e24cb892cf5e2bfa..2d95bf7416452474d7a169a0eafd398b234b1368 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2"  } */
+/* { dg-options "-O2 -fdump-tree-ccp1"  } */
 class SnmpSyntax
 {
 public:
@@ -27,4 +27,5 @@ void fn1 ()
         c.m_fn1 ();
       }
 }
-// Devirtualization to A::m_fn1 would be possible, but we can not do it at the moment
+/* { dg-final { scan-tree-dump-not "OBJ_TYPE_REF" "ccp1"  } } */
+/* { dg-final { cleanup-tree-dump "ccp1" } } */