This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Do not optimize some polymorphic calls with -fsanitize=undefined
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 5 Apr 2016 23:00:29 +0200
- Subject: Re: Do not optimize some polymorphic calls with -fsanitize=undefined
- Authentication-results: sourceware.org; auth=none
- References: <20160404155052 dot GA19779 at kam dot mff dot cuni dot cz> <20160404182544 dot GJ19207 at tucnak dot redhat dot com>
Hi,
this is patch I commited to address the feedback.
Regtested on x86_64-linux
Honza
* ipa-devirt.c (maybe_record_node): Fix comment; use
SANITIZE_UNREACHABLE instead of SANITIZE_UNDEFINED.
* g++.dg/ipa/devirt-51.C: Use -fsanitize=unreachable.
Index: ipa-devirt.c
===================================================================
--- ipa-devirt.c (revision 234761)
+++ ipa-devirt.c (working copy)
@@ -2438,9 +2438,9 @@ maybe_record_node (vec <cgraph_node *> &
{
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
+ /* When sanitizing, do not assume that __cxa_pure_virtual is not called
by valid program. */
- if (flag_sanitize & SANITIZE_UNDEFINED)
+ if (flag_sanitize & SANITIZE_UNREACHABLE)
;
/* Only add pure virtual if it is the only possible target. This way
we will preserve the diagnostics about pure virtual called in many
Index: testsuite/g++.dg/ipa/devirt-51.C
===================================================================
--- testsuite/g++.dg/ipa/devirt-51.C (revision 234761)
+++ testsuite/g++.dg/ipa/devirt-51.C (working copy)
@@ -2,7 +2,7 @@
variant. Either keeping virtual call or optimizing to cxa_pure_virtual
is fine. */
/* { dg-do compile } */
-/* { dg-options "-O2 -fsanitize=undefined -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fsanitize=unreachable -fdump-tree-optimized" } */
namespace {
struct B {
B* self;