https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62051

--- Comment #33 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Forgot patch
diff --git a/gcc/ipa-devirt.cc b/gcc/ipa-devirt.cc
index 8577e9b30fb..27d75f7834f 100644
--- a/gcc/ipa-devirt.cc
+++ b/gcc/ipa-devirt.cc
@@ -284,7 +284,15 @@ type_possibly_instantiated_p (tree t)
   if (TREE_CODE (vtable) == POINTER_PLUS_EXPR)
     vtable = TREE_OPERAND (TREE_OPERAND (vtable, 0), 0);
   vnode = varpool_node::get (vtable);
-  return vnode && vnode->definition;
+  //fprintf (stderr, "%i\n", vnode != NULL);
+  if (vnode && vnode->definition)
+    return true;
+  FOR_EACH_VARIABLE (vnode)
+    if (vnode->definition
+       && DECL_VIRTUAL_P (vnode->decl)
+       && get_odr_type (DECL_CONTEXT (vnode->decl), t))
+    return true;
+  return false;
 }

 /* Return true if T or type derived from T may have instance.  */

Reply via email to