This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Do not optimize some polymorphic calls with -fsanitize=undefined


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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]