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: [PATCH] Zero vptr in dtor for -fsanitize=vptr.


Thanks for review. I actually noticed your introduction of
cp_build_fold_indirect_ref after I installed my patch.

I'm testing following fix.

Martin
>From 63d9cff5c183f3614cff527ff991e1586a9efa5b Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 15 Nov 2017 10:01:51 +0100
Subject: [PATCH] Fix fallout of -fsanitize=vptr.

gcc/cp/ChangeLog:

2017-11-15  Martin Liska  <mliska@suse.cz>

	* decl.c (begin_destructor_body): Use cp_build_fold_indirect_ref
	instead of cp_build_indirect_ref.
---
 gcc/cp/decl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 041893db937..7e16f7b415b 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -15253,8 +15253,7 @@ begin_destructor_body (void)
 	  {
 	    tree binfo = TYPE_BINFO (current_class_type);
 	    tree ref
-	      = cp_build_indirect_ref (current_class_ptr, RO_NULL,
-				       tf_warning_or_error);
+	      = cp_build_fold_indirect_ref (current_class_ptr);
 
 	    tree vtbl_ptr = build_vfield_ref (ref, TREE_TYPE (binfo));
 	    tree vtbl = build_zero_cst (TREE_TYPE (vtbl_ptr));
-- 
2.14.3


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