From 8479ed2c47d9d9384180381f2af7c0a9dc03cc4e Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Fri, 3 Mar 2017 12:58:03 +0100 Subject: [PATCH] Properly handle __cxa_pure_virtual visibility (PR lto/79760). 2017-03-03 Jan Hubicka PR lto/79760 * ipa-devirt.c (maybe_record_node): Properly handle __cxa_pure_virtual visibility. From-SVN: r245870 --- gcc/ChangeLog | 6 ++++++ gcc/ipa-devirt.c | 17 +++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 68a03df81c9..1fa51ddf405 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-03-03 Jan Hubicka + + PR lto/79760 + * ipa-devirt.c (maybe_record_node): Properly handle + __cxa_pure_virtual visibility. + 2017-03-03 Martin Liska PR tree-optimization/79803 diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index 4428d679722..0e5eb85b61d 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -2462,10 +2462,19 @@ maybe_record_node (vec &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; } -- 2.30.2