diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2016-04-04 17:54:39 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2016-04-04 15:54:39 +0000 |
commit | d27ecc497ca88c0e24dcbd2e9f7c718bfbfe890f (patch) | |
tree | 2bbe94b9b2ad465cd2867fcbb69022ccb38e5598 /gcc/ipa-devirt.c | |
parent | c974c96edf3bdb5d95ba997526e92ce834c0aaa1 (diff) | |
download | gcc-d27ecc497ca88c0e24dcbd2e9f7c718bfbfe890f.tar.gz |
re PR ipa/66223 (Diagnostic of pure virtual function call broken, including __cxa_pure_virtual)
PR ipa/66223
* ipa-devirt.c (maybe_record_node): Do not optimize cxa_pure_virtual
calls when sanitizing.
(possible_polymorphic_call_target_p)" FIx formating.
* g++.dg/ipa/devirt-51.C: New testcase.
From-SVN: r234719
Diffstat (limited to 'gcc/ipa-devirt.c')
-rw-r--r-- | gcc/ipa-devirt.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index 069495105bf..22ece9f76af 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -2438,10 +2438,14 @@ maybe_record_node (vec <cgraph_node *> &nodes, { gcc_assert (!target_node->global.inlined_to); gcc_assert (target_node->real_symbol_p ()); + /* When sanitizing, do not asume that cxa_pure_virutal is not called + by valid program. */ + if (flag_sanitize & SANITIZE_UNDEFINED) + ; /* Only add pure virtual if it is the only possible target. This way we will preserve the diagnostics about pure virtual called in many cases without disabling optimization in other. */ - if (pure_virtual) + else if (pure_virtual) { if (nodes.length ()) return; @@ -3374,8 +3378,7 @@ possible_polymorphic_call_target_p (tree otr_type, bool final; if (TREE_CODE (TREE_TYPE (n->decl)) == FUNCTION_TYPE - && ((fcode = DECL_FUNCTION_CODE (n->decl)) - == BUILT_IN_UNREACHABLE + && ((fcode = DECL_FUNCTION_CODE (n->decl)) == BUILT_IN_UNREACHABLE || fcode == BUILT_IN_TRAP)) return true; |