Properly handle __cxa_pure_virtual visibility (PR lto/79760).
authorJan Hubicka <jh@suse.cz>
Fri, 3 Mar 2017 11:58:03 +0000 (12:58 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Fri, 3 Mar 2017 11:58:03 +0000 (11:58 +0000)
2017-03-03  Jan Hubicka  <jh@suse.cz>

PR lto/79760
* ipa-devirt.c (maybe_record_node): Properly handle
__cxa_pure_virtual visibility.

From-SVN: r245870

gcc/ChangeLog
gcc/ipa-devirt.c

index 68a03df81c9d8be3482cdb9262f7e506af172e11..1fa51ddf405a92a3b107c7a4eccc6023dee37cf2 100644 (file)
@@ -1,3 +1,9 @@
+2017-03-03  Jan Hubicka  <jh@suse.cz>
+
+       PR lto/79760
+       * ipa-devirt.c (maybe_record_node): Properly handle
+       __cxa_pure_virtual visibility.
+
 2017-03-03  Martin Liska  <mliska@suse.cz>
 
        PR tree-optimization/79803
index 4428d679722e20bfab8f011e1a12e842421e4da1..0e5eb85b61d6b914ccf499e53ff646fe40edbcfd 100644 (file)
@@ -2462,10 +2462,19 @@ maybe_record_node (vec <cgraph_node *> &nodes,
          nodes.safe_push (target_node);
        }
     }
-  else if (completep
-          && (!type_in_anonymous_namespace_p
-                (DECL_CONTEXT (target))
-              || flag_ltrans))
+  else if (!completep)
+    ;
+  /* We have definition of __cxa_pure_virtual that is not accessible (it is
+     optimized out or partitioned to other unit) so we can not add it.  When
+     not sanitizing, there is nothing to do.
+     Otherwise declare the list incomplete.  */
+  else if (pure_virtual)
+    {
+      if (flag_sanitize & SANITIZE_UNREACHABLE)
+       *completep = false;
+    }
+  else if (flag_ltrans
+          || !type_in_anonymous_namespace_p (DECL_CONTEXT (target)))
     *completep = false;
 }