[{"id":1794772,"web_url":"http://patchwork.ozlabs.org/comment/1794772/","msgid":"<20171027105212.GC14653@tucnak>","list_archive_url":null,"date":"2017-10-27T10:52:12","subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","submitter":{"id":671,"url":"http://patchwork.ozlabs.org/api/people/671/","name":"Jakub Jelinek","email":"jakub@redhat.com"},"content":"On Fri, Oct 27, 2017 at 12:47:12PM +0200, Martin Liška wrote:\n> Hello.\n> \n> This is small improvement that can catch a virtual call after a lifetime\n> scope of an object.\n> \n> \n> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.\n> \n> Ready to be installed?\n\nThe decl.c change seems to be only incremental change from a not publicly\nposted patch rather than the full diff against trunk.\n\n> 2017-10-27  Martin Liska  <mliska@suse.cz>\n> \n> \t* decl.c (begin_destructor_body): In case of disabled recovery,\n> \twe can zero object in order to catch virtual calls after\n> \tan object lifetime.\n> \n> gcc/testsuite/ChangeLog:\n> \n> 2017-10-27  Martin Liska  <mliska@suse.cz>\n> \n> \t* g++.dg/ubsan/vptr-12.C: New test.\n> ---\n>  gcc/cp/decl.c                        |  3 ++-\n>  gcc/testsuite/g++.dg/ubsan/vptr-12.C | 26 ++++++++++++++++++++++++++\n>  2 files changed, 28 insertions(+), 1 deletion(-)\n>  create mode 100644 gcc/testsuite/g++.dg/ubsan/vptr-12.C\n> \n> \n\n> diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c\n> index 15a8d283353..69636e30008 100644\n> --- a/gcc/cp/decl.c\n> +++ b/gcc/cp/decl.c\n> @@ -15281,7 +15281,8 @@ begin_destructor_body (void)\n>  \t  /* Clobbering an empty base is harmful if it overlays real data.  */\n>  \t  && !is_empty_class (current_class_type))\n>  \t{\n> -\t  if (sanitize_flags_p (SANITIZE_VPTR))\n> +\t  if (sanitize_flags_p (SANITIZE_VPTR)\n> +\t      && (flag_sanitize_recover & SANITIZE_VPTR) == 0)\n>  \t    {\n>  \t      tree fndecl = builtin_decl_explicit (BUILT_IN_MEMSET);\n>  \t      tree call = build_call_expr (fndecl, 3,\n\n\tJakub","headers":{"Return-Path":"<gcc-patches-return-465320-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-465320-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"EW7mvG2s\"; dkim-atps=neutral","sourceware.org; auth=none","ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=jakub@redhat.com"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yNgmw4nFJz9rxj\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 27 Oct 2017 21:57:04 +1100 (AEDT)","(qmail 122526 invoked by alias); 27 Oct 2017 10:52:20 -0000","(qmail 122471 invoked by uid 89); 27 Oct 2017 10:52:20 -0000","from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 27 Oct 2017 10:52:18 +0000","from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.phx2.redhat.com\n\t[10.5.11.13])\t(using TLSv1.2 with cipher AECDH-AES256-SHA\n\t(256/256 bits))\t(No client certificate requested)\tby\n\tmx1.redhat.com (Postfix) with ESMTPS id 77F987D0F1;\n\tFri, 27 Oct 2017 10:52:17 +0000 (UTC)","from tucnak.zalov.cz (ovpn-116-247.ams2.redhat.com\n\t[10.36.116.247])\tby smtp.corp.redhat.com (Postfix) with\n\tESMTPS id 1B50C60602; Fri, 27 Oct 2017 10:52:16 +0000 (UTC)","from tucnak.zalov.cz (localhost [127.0.0.1])\tby tucnak.zalov.cz\n\t(8.15.2/8.15.2) with ESMTP id v9RAqEDq028805;\n\tFri, 27 Oct 2017 12:52:14 +0200","(from jakub@localhost)\tby tucnak.zalov.cz (8.15.2/8.15.2/Submit)\n\tid v9RAqDqH028804; Fri, 27 Oct 2017 12:52:13 +0200"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:reply-to:references:mime-version\n\t:content-type:content-transfer-encoding:in-reply-to; q=dns; s=\n\tdefault; b=xOUv6/yJVXBo/aqh3dSNHPHFwmY1oGhmkb8Pe3nVe8P613Yg1GCRO\n\t25i+evNv2gwQtzghPOUUYWGp+7C+1abJspWS0nemj4rJ/Bm0MofAcgEgh6dH8uXC\n\tT5Xz4dkN/XOI7ppqBIpSG9JkWflAP1a+ujzrrAbmd/aajbis4ahTkY=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:reply-to:references:mime-version\n\t:content-type:content-transfer-encoding:in-reply-to; s=default;\n\tbh=Op7dSMbXPMn6lgGzYjFwZt9w1wQ=; b=EW7mvG2sbAk7m7ZRqFZD83F0ib+f\n\tCGzU+2QzYSCRinkqopiTEDgVkJgucffuSDErBsWSu1a6qNCB8uZCn7qW1zZeBKou\n\tibDLQt6KCxGX73kDRd5alzU4R1e5T3Opch6Kt5YBZUozErbj9nlk1t6U9aZRt7Az\n\tAO4uvCwF4GC0Pxs=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD,\n\tSPF_HELO_PASS autolearn=ham version=3.3.2 spammy=","X-HELO":"mx1.redhat.com","DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 77F987D0F1","Date":"Fri, 27 Oct 2017 12:52:12 +0200","From":"Jakub Jelinek <jakub@redhat.com>","To":"Martin =?utf-8?b?TGnFoWth?= <mliska@suse.cz>","Cc":"gcc-patches@gcc.gnu.org, Jason Merrill <jason@redhat.com>","Subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","Message-ID":"<20171027105212.GC14653@tucnak>","Reply-To":"Jakub Jelinek <jakub@redhat.com>","References":"<1d468e04-9f25-65f4-04a1-51b35abb3582@suse.cz>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<1d468e04-9f25-65f4-04a1-51b35abb3582@suse.cz>","User-Agent":"Mutt/1.7.1 (2016-10-04)","X-IsSubscribed":"yes"}},{"id":1794783,"web_url":"http://patchwork.ozlabs.org/comment/1794783/","msgid":"<63fcd2b6-44d0-cb4b-d518-99eb496c1686@suse.cz>","list_archive_url":null,"date":"2017-10-27T11:16:08","subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","submitter":{"id":62010,"url":"http://patchwork.ozlabs.org/api/people/62010/","name":"Martin Liška","email":"mliska@suse.cz"},"content":"On 10/27/2017 12:52 PM, Jakub Jelinek wrote:\n> The decl.c change seems to be only incremental change from a not publicly\n> posted patch rather than the full diff against trunk.\n\nSorry for that. Sending full patch.\n\nMartin\nFrom df0cc0c2da18b150b1f0fbef418450a223470d7f Mon Sep 17 00:00:00 2001\nFrom: marxin <mliska@suse.cz>\nDate: Thu, 19 Oct 2017 11:10:19 +0200\nSubject: [PATCH] Zero vptr in dtor for -fsanitize=vptr.\n\ngcc/cp/ChangeLog:\n\n2017-10-27  Martin Liska  <mliska@suse.cz>\n\n\t* decl.c (begin_destructor_body): In case of disabled recovery,\n\twe can zero object in order to catch virtual calls after\n\tan object lifetime.\n\ngcc/testsuite/ChangeLog:\n\n2017-10-27  Martin Liska  <mliska@suse.cz>\n\n\t* g++.dg/ubsan/vptr-12.C: New test.\n---\n gcc/cp/decl.c                        | 14 +++++++++++++-\n gcc/testsuite/g++.dg/ubsan/vptr-12.C | 26 ++++++++++++++++++++++++++\n 2 files changed, 39 insertions(+), 1 deletion(-)\n create mode 100644 gcc/testsuite/g++.dg/ubsan/vptr-12.C\n\ndiff --git a/gcc/cp/decl.c b/gcc/cp/decl.c\nindex 42b52748e2a..69636e30008 100644\n--- a/gcc/cp/decl.c\n+++ b/gcc/cp/decl.c\n@@ -15280,7 +15280,19 @@ begin_destructor_body (void)\n       if (flag_lifetime_dse\n \t  /* Clobbering an empty base is harmful if it overlays real data.  */\n \t  && !is_empty_class (current_class_type))\n-\tfinish_decl_cleanup (NULL_TREE, build_clobber_this ());\n+\t{\n+\t  if (sanitize_flags_p (SANITIZE_VPTR)\n+\t      && (flag_sanitize_recover & SANITIZE_VPTR) == 0)\n+\t    {\n+\t      tree fndecl = builtin_decl_explicit (BUILT_IN_MEMSET);\n+\t      tree call = build_call_expr (fndecl, 3,\n+\t\t\t\t\t   current_class_ptr, integer_zero_node,\n+\t\t\t\t\t   TYPE_SIZE_UNIT (current_class_type));\n+\t      finish_decl_cleanup (NULL_TREE, call);\n+\t    }\n+\t  else\n+\t    finish_decl_cleanup (NULL_TREE, build_clobber_this ());\n+\t}\n \n       /* And insert cleanups for our bases and members so that they\n \t will be properly destroyed if we throw.  */\ndiff --git a/gcc/testsuite/g++.dg/ubsan/vptr-12.C b/gcc/testsuite/g++.dg/ubsan/vptr-12.C\nnew file mode 100644\nindex 00000000000..96c8473d757\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/ubsan/vptr-12.C\n@@ -0,0 +1,26 @@\n+// { dg-do run }\n+// { dg-shouldfail \"ubsan\" }\n+// { dg-options \"-fsanitize=vptr -fno-sanitize-recover=vptr\" }\n+\n+struct MyClass\n+{\n+  virtual ~MyClass () {}\n+  virtual void\n+  Doit ()\n+  {\n+  }\n+};\n+\n+int\n+main ()\n+{\n+  MyClass *c = new MyClass;\n+  c->~MyClass ();\n+  c->Doit ();\n+\n+  return 0;\n+}\n+\n+// { dg-output \"\\[^\\n\\r]*vptr-12.C:19:\\[0-9]*: runtime error: member call on address 0x\\[0-9a-fA-F]* which does not point to an object of type 'MyClass'(\\n|\\r\\n|\\r)\" }\n+// { dg-output \"0x\\[0-9a-fA-F]*: note: object has invalid vptr(\\n|\\r\\n|\\r)\" }\n+","headers":{"Return-Path":"<gcc-patches-return-465322-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-465322-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"xIvN6mil\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yNhCD0Yyvz9sNx\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 27 Oct 2017 22:16:20 +1100 (AEDT)","(qmail 82491 invoked by alias); 27 Oct 2017 11:16:13 -0000","(qmail 82476 invoked by uid 89); 27 Oct 2017 11:16:12 -0000","from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 27 Oct 2017 11:16:11 +0000","from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254])\tby\n\tmx2.suse.de (Postfix) with ESMTP id BF0B8ABFC;\n\tFri, 27 Oct 2017 11:16:08 +0000 (UTC)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type; q=dns; s=default; b=Y4ewzMFdpK+nmqs33\n\tGMU4BDHL394vr62489BXeNA/HxNUHaB01QWGOJRHR78p7YjUCEaUuIXsoZKPkjMg\n\thVmGx79LO90+5gsDRu0WKbrbUiQIcRQJTPhCJ1UZp1R7r5nWW0dZHZoRB7uw5qh0\n\tmlA9bXugKdusaSEFJZXcPon5Eo=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type; s=default; bh=lY58DbZUstV81mfv83qGrsl\n\tXG84=; b=xIvN6milq41otn7LzxKKejH6axQNSZ3gNoEfxECpjP5WxgrET2flIUO\n\t0c9us3K7egacTLb8LS9wUR0aLfGwaQWdbyae1lfJXRgobOQ9OZU8vIYICG9PH5IU\n\tx2wJ9rpMx4N+3h5Z+17ESBYlZfn1uzUW3/w5Hv1KZSICXNG+O164=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=","X-HELO":"mx2.suse.de","Subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","To":"Jakub Jelinek <jakub@redhat.com>","Cc":"gcc-patches@gcc.gnu.org, Jason Merrill <jason@redhat.com>","References":"<1d468e04-9f25-65f4-04a1-51b35abb3582@suse.cz>\n\t<20171027105212.GC14653@tucnak>","From":"=?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz>","Message-ID":"<63fcd2b6-44d0-cb4b-d518-99eb496c1686@suse.cz>","Date":"Fri, 27 Oct 2017 13:16:08 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64;\n\trv:52.0) Gecko/20100101 Thunderbird/52.4.0","MIME-Version":"1.0","In-Reply-To":"<20171027105212.GC14653@tucnak>","Content-Type":"multipart/mixed;\n\tboundary=\"------------F6396C86AA8ABF6B2E6481A3\"","X-IsSubscribed":"yes"}},{"id":1794785,"web_url":"http://patchwork.ozlabs.org/comment/1794785/","msgid":"<20171027112600.GD14653@tucnak>","list_archive_url":null,"date":"2017-10-27T11:26:00","subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","submitter":{"id":671,"url":"http://patchwork.ozlabs.org/api/people/671/","name":"Jakub Jelinek","email":"jakub@redhat.com"},"content":"On Fri, Oct 27, 2017 at 01:16:08PM +0200, Martin Liška wrote:\n> On 10/27/2017 12:52 PM, Jakub Jelinek wrote:\n> > The decl.c change seems to be only incremental change from a not publicly\n> > posted patch rather than the full diff against trunk.\n> \n> Sorry for that. Sending full patch.\n\nThanks.\n\n> --- a/gcc/cp/decl.c\n> +++ b/gcc/cp/decl.c\n> @@ -15280,7 +15280,19 @@ begin_destructor_body (void)\n>        if (flag_lifetime_dse\n>  \t  /* Clobbering an empty base is harmful if it overlays real data.  */\n>  \t  && !is_empty_class (current_class_type))\n> -\tfinish_decl_cleanup (NULL_TREE, build_clobber_this ());\n> +\t{\n> +\t  if (sanitize_flags_p (SANITIZE_VPTR)\n> +\t      && (flag_sanitize_recover & SANITIZE_VPTR) == 0)\n> +\t    {\n> +\t      tree fndecl = builtin_decl_explicit (BUILT_IN_MEMSET);\n> +\t      tree call = build_call_expr (fndecl, 3,\n> +\t\t\t\t\t   current_class_ptr, integer_zero_node,\n> +\t\t\t\t\t   TYPE_SIZE_UNIT (current_class_type));\n\nI wonder if it wouldn't be cheaper to just use thisref = {}; rather than\nmemset, pretty much the same thing as build_clobber_this () emits, except\nfor the TREE_VOLATILE.  Also, build_clobber_this has:\n  if (vbases)\n    exprstmt = build_if_in_charge (exprstmt);\nso it doesn't clobber if not in charge, not sure if it applies here too.\nSo maybe easiest would be add a bool argument to build_clobber_this which\nwould say whether it is a clobber or real clearing?\n\n> +\t      finish_decl_cleanup (NULL_TREE, call);\n> +\t    }\n> +\t  else\n> +\t    finish_decl_cleanup (NULL_TREE, build_clobber_this ());\n> +\t}\n>  \n>        /* And insert cleanups for our bases and members so that they\n>  \t will be properly destroyed if we throw.  */\n> diff --git a/gcc/testsuite/g++.dg/ubsan/vptr-12.C b/gcc/testsuite/g++.dg/ubsan/vptr-12.C\n> new file mode 100644\n> index 00000000000..96c8473d757\n> --- /dev/null\n> +++ b/gcc/testsuite/g++.dg/ubsan/vptr-12.C\n> @@ -0,0 +1,26 @@\n> +// { dg-do run }\n> +// { dg-shouldfail \"ubsan\" }\n> +// { dg-options \"-fsanitize=vptr -fno-sanitize-recover=vptr\" }\n> +\n> +struct MyClass\n> +{\n> +  virtual ~MyClass () {}\n> +  virtual void\n> +  Doit ()\n> +  {\n> +  }\n\nWhy not put all the above 4 lines into a single one, the dtor already uses\nthat kind of formatting.\n\n> +};\n> +\n> +int\n> +main ()\n> +{\n> +  MyClass *c = new MyClass;\n> +  c->~MyClass ();\n> +  c->Doit ();\n> +\n> +  return 0;\n> +}\n> +\n> +// { dg-output \"\\[^\\n\\r]*vptr-12.C:19:\\[0-9]*: runtime error: member call on address 0x\\[0-9a-fA-F]* which does not point to an object of type 'MyClass'(\\n|\\r\\n|\\r)\" }\n> +// { dg-output \"0x\\[0-9a-fA-F]*: note: object has invalid vptr(\\n|\\r\\n|\\r)\" }\n> +\n\nUnnecessary empty line at end.\n\n\tJakub","headers":{"Return-Path":"<gcc-patches-return-465323-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-465323-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"wsGOBISE\"; dkim-atps=neutral","sourceware.org; auth=none","ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=jakub@redhat.com"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yNhQh6XkPz9t2M\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 27 Oct 2017 22:26:17 +1100 (AEDT)","(qmail 127723 invoked by alias); 27 Oct 2017 11:26:09 -0000","(qmail 127710 invoked by uid 89); 27 Oct 2017 11:26:08 -0000","from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 27 Oct 2017 11:26:07 +0000","from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.phx2.redhat.com\n\t[10.5.11.13])\t(using TLSv1.2 with cipher AECDH-AES256-SHA\n\t(256/256 bits))\t(No client certificate requested)\tby\n\tmx1.redhat.com (Postfix) with ESMTPS id B02B64E028;\n\tFri, 27 Oct 2017 11:26:05 +0000 (UTC)","from tucnak.zalov.cz (ovpn-116-247.ams2.redhat.com\n\t[10.36.116.247])\tby smtp.corp.redhat.com (Postfix) with\n\tESMTPS id 4189C6062A; Fri, 27 Oct 2017 11:26:05 +0000 (UTC)","from tucnak.zalov.cz (localhost [127.0.0.1])\tby tucnak.zalov.cz\n\t(8.15.2/8.15.2) with ESMTP id v9RBQ2t1028870;\n\tFri, 27 Oct 2017 13:26:02 +0200","(from jakub@localhost)\tby tucnak.zalov.cz (8.15.2/8.15.2/Submit)\n\tid v9RBQ05h028869; Fri, 27 Oct 2017 13:26:00 +0200"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:reply-to:references:mime-version\n\t:content-type:content-transfer-encoding:in-reply-to; q=dns; s=\n\tdefault; b=JQCeH+fYEcYY1rLy26FZXVjL/NMVTYDcTrxhqFud/VOQGLRzjoWE3\n\tzKQszFPX0AbsuDPLxGTGZs+GqPOwMPZCMoMPURH2/mfop4Zb4hKXxTaoYZ3HE/wz\n\thHslvXQLEgEEDxoMAFkvIp2iHurDO5p9cZRv0s1Bwn2OKfIFx+ZenU=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:reply-to:references:mime-version\n\t:content-type:content-transfer-encoding:in-reply-to; s=default;\n\tbh=02oN9XJX/jJqCYWw3O9lYZE6jIs=; b=wsGOBISEaJIuBlh41ya4j3F1rXRT\n\tc93Dfk++n1NxkK9mPaVsFGmzpcAUq2UvdH7ewUSx6NPQuIJMIRAGLW2gSR0FdfDn\n\t9t4zplQ5LshLQZxmBP+L9MnCPQWS3vBndRDAFgbK9T8y+iW2AUwvI2JTZM6H6/0k\n\tyhvdjygVKfTzLRg=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD,\n\tSPF_HELO_PASS autolearn=ham version=3.3.2\n\tspammy=Hx-languages-length:2592","X-HELO":"mx1.redhat.com","DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com B02B64E028","Date":"Fri, 27 Oct 2017 13:26:00 +0200","From":"Jakub Jelinek <jakub@redhat.com>","To":"Martin =?utf-8?b?TGnFoWth?= <mliska@suse.cz>","Cc":"gcc-patches@gcc.gnu.org, Jason Merrill <jason@redhat.com>","Subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","Message-ID":"<20171027112600.GD14653@tucnak>","Reply-To":"Jakub Jelinek <jakub@redhat.com>","References":"<1d468e04-9f25-65f4-04a1-51b35abb3582@suse.cz>\n\t<20171027105212.GC14653@tucnak>\n\t<63fcd2b6-44d0-cb4b-d518-99eb496c1686@suse.cz>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<63fcd2b6-44d0-cb4b-d518-99eb496c1686@suse.cz>","User-Agent":"Mutt/1.7.1 (2016-10-04)","X-IsSubscribed":"yes"}},{"id":1794872,"web_url":"http://patchwork.ozlabs.org/comment/1794872/","msgid":"<c28079ae-8d28-113a-8c02-7e60e86b52bb@suse.cz>","list_archive_url":null,"date":"2017-10-27T13:48:41","subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","submitter":{"id":62010,"url":"http://patchwork.ozlabs.org/api/people/62010/","name":"Martin Liška","email":"mliska@suse.cz"},"content":"On 10/27/2017 01:26 PM, Jakub Jelinek wrote:\n> On Fri, Oct 27, 2017 at 01:16:08PM +0200, Martin Liška wrote:\n>> On 10/27/2017 12:52 PM, Jakub Jelinek wrote:\n>>> The decl.c change seems to be only incremental change from a not publicly\n>>> posted patch rather than the full diff against trunk.\n>>\n>> Sorry for that. Sending full patch.\n> \n> Thanks.\n> \n>> --- a/gcc/cp/decl.c\n>> +++ b/gcc/cp/decl.c\n>> @@ -15280,7 +15280,19 @@ begin_destructor_body (void)\n>>         if (flag_lifetime_dse\n>>   \t  /* Clobbering an empty base is harmful if it overlays real data.  */\n>>   \t  && !is_empty_class (current_class_type))\n>> -\tfinish_decl_cleanup (NULL_TREE, build_clobber_this ());\n>> +\t{\n>> +\t  if (sanitize_flags_p (SANITIZE_VPTR)\n>> +\t      && (flag_sanitize_recover & SANITIZE_VPTR) == 0)\n>> +\t    {\n>> +\t      tree fndecl = builtin_decl_explicit (BUILT_IN_MEMSET);\n>> +\t      tree call = build_call_expr (fndecl, 3,\n>> +\t\t\t\t\t   current_class_ptr, integer_zero_node,\n>> +\t\t\t\t\t   TYPE_SIZE_UNIT (current_class_type));\n> \n> I wonder if it wouldn't be cheaper to just use thisref = {}; rather than\n> memset, pretty much the same thing as build_clobber_this () emits, except\n> for the TREE_VOLATILE.  Also, build_clobber_this has:\n>    if (vbases)\n>      exprstmt = build_if_in_charge (exprstmt);\n> so it doesn't clobber if not in charge, not sure if it applies here too.\n> So maybe easiest would be add a bool argument to build_clobber_this which\n> would say whether it is a clobber or real clearing?\n\nHello.\n\nDid that in newer version of the patch, good idea!\n\n> \n>> +\t      finish_decl_cleanup (NULL_TREE, call);\n>> +\t    }\n>> +\t  else\n>> +\t    finish_decl_cleanup (NULL_TREE, build_clobber_this ());\n>> +\t}\n>>   \n>>         /* And insert cleanups for our bases and members so that they\n>>   \t will be properly destroyed if we throw.  */\n>> diff --git a/gcc/testsuite/g++.dg/ubsan/vptr-12.C b/gcc/testsuite/g++.dg/ubsan/vptr-12.C\n>> new file mode 100644\n>> index 00000000000..96c8473d757\n>> --- /dev/null\n>> +++ b/gcc/testsuite/g++.dg/ubsan/vptr-12.C\n>> @@ -0,0 +1,26 @@\n>> +// { dg-do run }\n>> +// { dg-shouldfail \"ubsan\" }\n>> +// { dg-options \"-fsanitize=vptr -fno-sanitize-recover=vptr\" }\n>> +\n>> +struct MyClass\n>> +{\n>> +  virtual ~MyClass () {}\n>> +  virtual void\n>> +  Doit ()\n>> +  {\n>> +  }\n> \n> Why not put all the above 4 lines into a single one, the dtor already uses\n> that kind of formatting.\n\nSure.\n\n> \n>> +};\n>> +\n>> +int\n>> +main ()\n>> +{\n>> +  MyClass *c = new MyClass;\n>> +  c->~MyClass ();\n>> +  c->Doit ();\n>> +\n>> +  return 0;\n>> +}\n>> +\n>> +// { dg-output \"\\[^\\n\\r]*vptr-12.C:19:\\[0-9]*: runtime error: member call on address 0x\\[0-9a-fA-F]* which does not point to an object of type 'MyClass'(\\n|\\r\\n|\\r)\" }\n>> +// { dg-output \"0x\\[0-9a-fA-F]*: note: object has invalid vptr(\\n|\\r\\n|\\r)\" }\n>> +\n> \n> Unnecessary empty line at end.\n\nLikewise.\n\nMartin\n\n> \n> \tJakub\n>\nFrom b1da5f4de8b630f284627f422b902d28cd1d408b Mon Sep 17 00:00:00 2001\nFrom: marxin <mliska@suse.cz>\nDate: Thu, 19 Oct 2017 11:10:19 +0200\nSubject: [PATCH] Zero vptr in dtor for -fsanitize=vptr.\n\ngcc/cp/ChangeLog:\n\n2017-10-27  Martin Liska  <mliska@suse.cz>\n\n\t* decl.c (build_clobber_this): Rename to ...\n\t(build_this_constructor): ... this. Add argument clobber_p.\n\t(start_preparsed_function): Use the argument.\n\t(begin_destructor_body): In case of disabled recovery,\n\twe can zero object in order to catch virtual calls after\n\tan object lifetime.\n\ngcc/testsuite/ChangeLog:\n\n2017-10-27  Martin Liska  <mliska@suse.cz>\n\n\t* g++.dg/ubsan/vptr-12.C: New test.\n---\n gcc/cp/decl.c                        | 18 ++++++++++++++----\n gcc/testsuite/g++.dg/ubsan/vptr-12.C | 22 ++++++++++++++++++++++\n 2 files changed, 36 insertions(+), 4 deletions(-)\n create mode 100644 gcc/testsuite/g++.dg/ubsan/vptr-12.C\n\ndiff --git a/gcc/cp/decl.c b/gcc/cp/decl.c\nindex 519aa06a0f9..ee48d1c157e 100644\n--- a/gcc/cp/decl.c\n+++ b/gcc/cp/decl.c\n@@ -14639,8 +14639,12 @@ implicit_default_ctor_p (tree fn)\n /* Clobber the contents of *this to let the back end know that the object\n    storage is dead when we enter the constructor or leave the destructor.  */\n \n+/* Clobber or zero (depending on CLOBBER_P argument) the contents of *this\n+   to let the back end know that the object storage is dead\n+   when we enter the constructor or leave the destructor.  */\n+\n static tree\n-build_clobber_this ()\n+build_this_constructor (bool clobber_p)\n {\n   /* Clobbering an empty base is pointless, and harmful if its one byte\n      TYPE_SIZE overlays real data.  */\n@@ -14657,7 +14661,9 @@ build_clobber_this ()\n     ctype = CLASSTYPE_AS_BASE (ctype);\n \n   tree clobber = build_constructor (ctype, NULL);\n-  TREE_THIS_VOLATILE (clobber) = true;\n+\n+  if (clobber_p)\n+    TREE_THIS_VOLATILE (clobber) = true;\n \n   tree thisref = current_class_ref;\n   if (ctype != current_class_type)\n@@ -15086,7 +15092,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags)\n \t because part of the initialization might happen before we enter the\n \t constructor, via AGGR_INIT_ZERO_FIRST (c++/68006).  */\n       && !implicit_default_ctor_p (decl1))\n-    finish_expr_stmt (build_clobber_this ());\n+    finish_expr_stmt (build_this_constructor (true));\n \n   if (!processing_template_decl\n       && DECL_CONSTRUCTOR_P (decl1)\n@@ -15301,7 +15307,11 @@ begin_destructor_body (void)\n       if (flag_lifetime_dse\n \t  /* Clobbering an empty base is harmful if it overlays real data.  */\n \t  && !is_empty_class (current_class_type))\n-\tfinish_decl_cleanup (NULL_TREE, build_clobber_this ());\n+\t{\n+\t  bool s = (sanitize_flags_p (SANITIZE_VPTR)\n+\t\t    && (flag_sanitize_recover & SANITIZE_VPTR) == 0);\n+\t  finish_decl_cleanup (NULL_TREE, build_this_constructor (!s));\n+\t}\n \n       /* And insert cleanups for our bases and members so that they\n \t will be properly destroyed if we throw.  */\ndiff --git a/gcc/testsuite/g++.dg/ubsan/vptr-12.C b/gcc/testsuite/g++.dg/ubsan/vptr-12.C\nnew file mode 100644\nindex 00000000000..51b9d36d3f2\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/ubsan/vptr-12.C\n@@ -0,0 +1,22 @@\n+// { dg-do run }\n+// { dg-shouldfail \"ubsan\" }\n+// { dg-options \"-fsanitize=vptr -fno-sanitize-recover=vptr\" }\n+\n+struct MyClass\n+{\n+  virtual ~MyClass () {}\n+  virtual void Doit () {}\n+};\n+\n+int\n+main ()\n+{\n+  MyClass *c = new MyClass;\n+  c->~MyClass ();\n+  c->Doit ();\n+\n+  return 0;\n+}\n+\n+// { dg-output \"\\[^\\n\\r]*vptr-12.C:19:\\[0-9]*: runtime error: member call on address 0x\\[0-9a-fA-F]* which does not point to an object of type 'MyClass'(\\n|\\r\\n|\\r)\" }\n+// { dg-output \"0x\\[0-9a-fA-F]*: note: object has invalid vptr(\\n|\\r\\n|\\r)\" }","headers":{"Return-Path":"<gcc-patches-return-465353-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-465353-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"XKn82xBT\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yNlbF1GCcz9t0F\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 28 Oct 2017 00:48:56 +1100 (AEDT)","(qmail 7981 invoked by alias); 27 Oct 2017 13:48:48 -0000","(qmail 7971 invoked by uid 89); 27 Oct 2017 13:48:47 -0000","from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 27 Oct 2017 13:48:45 +0000","from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254])\tby\n\tmx2.suse.de (Postfix) with ESMTP id 1E81BAB22;\n\tFri, 27 Oct 2017 13:48:42 +0000 (UTC)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type; q=dns; s=default; b=ttYvPC2wZJ7rByh5G\n\tL4pgGtwodx3Ft+rUWEWyKhVw7jIsy1LfAMgqJ6XpLlX3Ezo9XmcAl7niHgKP6bZh\n\tpsRM5cSckc+2xli2LMD1LF77tTNPLowe22WStP1n0GKrDowYxtHG3zB9ICtJGl8l\n\teHogNVRdtLDW9TML9xp1yQJB8M=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type; s=default; bh=0MU8Y7krpksoShSQiARHk/n\n\tKMGs=; b=XKn82xBT7xfEmeajTNnFIJF12DiDaAUXlX1W8QvrWYBrHKV9q/bz7Kr\n\ti7HcyPqJkMjjJqfF/Kl9vyqTIpDZof0zI37F0tEhp4Kwgtn33mOU1AcEzkfXgk6P\n\toQT6UzuVUzgSHVtvn6r+58gF5PEcF7i4nHsedVbwXVQOibLjLqOk=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=","X-HELO":"mx2.suse.de","Subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","To":"Jakub Jelinek <jakub@redhat.com>","Cc":"gcc-patches@gcc.gnu.org, Jason Merrill <jason@redhat.com>","References":"<1d468e04-9f25-65f4-04a1-51b35abb3582@suse.cz>\n\t<20171027105212.GC14653@tucnak>\n\t<63fcd2b6-44d0-cb4b-d518-99eb496c1686@suse.cz>\n\t<20171027112600.GD14653@tucnak>","From":"=?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz>","Message-ID":"<c28079ae-8d28-113a-8c02-7e60e86b52bb@suse.cz>","Date":"Fri, 27 Oct 2017 15:48:41 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64;\n\trv:52.0) Gecko/20100101 Thunderbird/52.4.0","MIME-Version":"1.0","In-Reply-To":"<20171027112600.GD14653@tucnak>","Content-Type":"multipart/mixed;\n\tboundary=\"------------F2C63E643F1A0BBF740CFAD5\"","X-IsSubscribed":"yes"}},{"id":1794878,"web_url":"http://patchwork.ozlabs.org/comment/1794878/","msgid":"<20171027135259.GG14653@tucnak>","list_archive_url":null,"date":"2017-10-27T13:52:59","subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","submitter":{"id":671,"url":"http://patchwork.ozlabs.org/api/people/671/","name":"Jakub Jelinek","email":"jakub@redhat.com"},"content":"On Fri, Oct 27, 2017 at 03:48:41PM +0200, Martin Liška wrote:\n> --- a/gcc/cp/decl.c\n> +++ b/gcc/cp/decl.c\n> @@ -14639,8 +14639,12 @@ implicit_default_ctor_p (tree fn)\n>  /* Clobber the contents of *this to let the back end know that the object\n>     storage is dead when we enter the constructor or leave the destructor.  */\n>  \n> +/* Clobber or zero (depending on CLOBBER_P argument) the contents of *this\n> +   to let the back end know that the object storage is dead\n> +   when we enter the constructor or leave the destructor.  */\n> +\n>  static tree\n> -build_clobber_this ()\n> +build_this_constructor (bool clobber_p)\n\nI think build_clobber_this is better name, but will defer final review\nto Jason or Nathan.  Also, seems there was already a function comment\nand you've added yet another one, instead of ammending the first one.\n\nOtherwise LGTM.\n\n\tJakub","headers":{"Return-Path":"<gcc-patches-return-465354-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-465354-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"GXZ5VyLX\"; dkim-atps=neutral","sourceware.org; auth=none","ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=jakub@redhat.com"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yNlhC4Tbgz9sCZ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 28 Oct 2017 00:53:15 +1100 (AEDT)","(qmail 16009 invoked by alias); 27 Oct 2017 13:53:08 -0000","(qmail 15992 invoked by uid 89); 27 Oct 2017 13:53:07 -0000","from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 27 Oct 2017 13:53:06 +0000","from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com\n\t[10.5.11.15])\t(using TLSv1.2 with cipher AECDH-AES256-SHA\n\t(256/256 bits))\t(No client certificate requested)\tby\n\tmx1.redhat.com (Postfix) with ESMTPS id 2587C369BD;\n\tFri, 27 Oct 2017 13:53:05 +0000 (UTC)","from tucnak.zalov.cz (ovpn-116-247.ams2.redhat.com\n\t[10.36.116.247])\tby smtp.corp.redhat.com (Postfix) with\n\tESMTPS id A89975D75E; Fri, 27 Oct 2017 13:53:04 +0000 (UTC)","from tucnak.zalov.cz (localhost [127.0.0.1])\tby tucnak.zalov.cz\n\t(8.15.2/8.15.2) with ESMTP id v9RDr10w002573;\n\tFri, 27 Oct 2017 15:53:02 +0200","(from jakub@localhost)\tby tucnak.zalov.cz (8.15.2/8.15.2/Submit)\n\tid v9RDr0t4002334; Fri, 27 Oct 2017 15:53:00 +0200"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:reply-to:references:mime-version\n\t:content-type:content-transfer-encoding:in-reply-to; q=dns; s=\n\tdefault; b=AS8+IEfjhlC4EJpmsNfxgxuU+uC+aURowCO9qKAkJpfUH0ZvwhlA9\n\tJrYTEsDlditAaUU1AVEa3NhHGmAjfKww+Lb9g4wEoTJwtD/Ua3f7Sw9EdT2ECpQp\n\t3iYEzaniyAGHIF0V77hXUyBZ8SyfejowGEcgIwzCluJME+mjOI+qtk=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:reply-to:references:mime-version\n\t:content-type:content-transfer-encoding:in-reply-to; s=default;\n\tbh=dpcYvgD4xksqXgGA9GJG9aJNEqU=; b=GXZ5VyLXcDhMLlsOwr/qJTzwTCBK\n\tfOTmrL1xo6R5/3rgFuNoqGoS/Y3Q8hmSVzg4WAAboXzJ4RzvkIDGxVbI1oFaNL4N\n\ttPdAKVSKLb1J+ExignRt9bR5z8nRdNCVqNMbcuJAi8FRJ4u95GL8ZalxJsMpGkDV\n\tXrceD7LLPArNRzw=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2,\n\tGIT_PATCH_3, RP_MATCHES_RCVD,\n\tSPF_HELO_PASS autolearn=ham version=3.3.2\n\tspammy=Hx-languages-length:897,\n\tHContent-Transfer-Encoding:8bit","X-HELO":"mx1.redhat.com","DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 2587C369BD","Date":"Fri, 27 Oct 2017 15:52:59 +0200","From":"Jakub Jelinek <jakub@redhat.com>","To":"Martin =?utf-8?b?TGnFoWth?=\n\t<mliska@suse.cz>, Jason Merrill <jason@redhat.com>,\n\tNathan Sidwell <nathan@acm.org>","Cc":"gcc-patches@gcc.gnu.org","Subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","Message-ID":"<20171027135259.GG14653@tucnak>","Reply-To":"Jakub Jelinek <jakub@redhat.com>","References":"<1d468e04-9f25-65f4-04a1-51b35abb3582@suse.cz>\n\t<20171027105212.GC14653@tucnak>\n\t<63fcd2b6-44d0-cb4b-d518-99eb496c1686@suse.cz>\n\t<20171027112600.GD14653@tucnak>\n\t<c28079ae-8d28-113a-8c02-7e60e86b52bb@suse.cz>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<c28079ae-8d28-113a-8c02-7e60e86b52bb@suse.cz>","User-Agent":"Mutt/1.7.1 (2016-10-04)","X-IsSubscribed":"yes"}},{"id":1795068,"web_url":"http://patchwork.ozlabs.org/comment/1795068/","msgid":"<CADzB+2kAqgX6dfhuNvcvAKatjQxRnvxTBQ2ZvD84WRubr_EFWA@mail.gmail.com>","list_archive_url":null,"date":"2017-10-27T18:10:10","subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","submitter":{"id":4337,"url":"http://patchwork.ozlabs.org/api/people/4337/","name":"Jason Merrill","email":"jason@redhat.com"},"content":"On Fri, Oct 27, 2017 at 9:52 AM, Jakub Jelinek <jakub@redhat.com> wrote:\n> On Fri, Oct 27, 2017 at 03:48:41PM +0200, Martin Liška wrote:\n>> --- a/gcc/cp/decl.c\n>> +++ b/gcc/cp/decl.c\n>> @@ -14639,8 +14639,12 @@ implicit_default_ctor_p (tree fn)\n>>  /* Clobber the contents of *this to let the back end know that the object\n>>     storage is dead when we enter the constructor or leave the destructor.  */\n>>\n>> +/* Clobber or zero (depending on CLOBBER_P argument) the contents of *this\n>> +   to let the back end know that the object storage is dead\n>> +   when we enter the constructor or leave the destructor.  */\n>> +\n>>  static tree\n>> -build_clobber_this ()\n>> +build_this_constructor (bool clobber_p)\n>\n> I think build_clobber_this is better name, but will defer final review\n> to Jason or Nathan.  Also, seems there was already a function comment\n> and you've added yet another one, instead of ammending the first one.\n\nAgreed.\n\nIf the point is to clear the vptr, why are you also clearing the rest\nof the object?\n\nJason","headers":{"Return-Path":"<gcc-patches-return-465386-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-465386-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"oONTscGZ\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yNsPJ4F1Cz9t48\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 28 Oct 2017 05:10:43 +1100 (AEDT)","(qmail 55916 invoked by alias); 27 Oct 2017 18:10:34 -0000","(qmail 55023 invoked by uid 89); 27 Oct 2017 18:10:34 -0000","from mail-io0-f196.google.com (HELO mail-io0-f196.google.com)\n\t(209.85.223.196) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 27 Oct 2017 18:10:33 +0000","by mail-io0-f196.google.com with SMTP id m81so14475775ioi.13 for\n\t<gcc-patches@gcc.gnu.org>; Fri, 27 Oct 2017 11:10:33 -0700 (PDT)","by 10.107.170.26 with HTTP; Fri, 27 Oct 2017 11:10:10 -0700 (PDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-type:content-transfer-encoding; q=dns; s=\n\tdefault; b=KqJObD8H1SuiwCWJVaeHdV9WgMOcA84zQAHT9AxtzNXUi8C6xHhN1\n\tVT3TK3a1E0VjzEmsmXdyKitHxo40v2H7SwEgHip6VWVlsJMydmNgp1I1pl27cORb\n\tefLnFcBzFSUJVQROUJX9IA8mbo6q+0P0kt5UemjvPo/cm4+cu6HBpA=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-type:content-transfer-encoding; s=\n\tdefault; bh=D5cwL/UNqBKqCts2GH5+hTUv0QM=; b=oONTscGZMbpLxBRF6aor\n\tOPrmQhqZKSsjsZnar33axxOGSa8+dgk+CthpeFlxllIwO6cu+RzkPYbufbVlw6/C\n\tOMHRYSYdJPXtkXMvUTlRRJfjyLBlj/wxcRx2SbwP5IvMVXTAME8oe5XR4UDS9uBI\n\teUkfVKOdkUg6EoA2wbYqHBE=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-11.5 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_SORBS_SPAM autolearn=ham version=3.3.2\n\tspammy=Hx-languages-length:1069","X-HELO":"mail-io0-f196.google.com","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=gcK2N6Cp0IuNbhsW0kyeyRMiQc/9WkLffk8Eg/XHtH8=;\n\tb=EBr4q9vDitReP03RDaPAFeIkZopJc/jb3Nmp1LePi9XMnKUl4f94ZDiiNwv4HDG3/m\n\tFELENd2oH1DL4r8wNB3JCkbtCP1Vt3DphBB2f0MQEtH8ssnIkM0+S1uf9Lwq9eWHgpK+\n\t5WwwW7ybIVZ84Y5yDjZApQsLllC8xDdDikIlFiO/aB4iTxXWMfFkYQtvTOOrXKLlGWSq\n\tntELiCx9IBFxCff/sk1jWmP4DAaLhIzSxjBnHWHmXsSoUApFXCiwJP7uI2auo3LkbuIe\n\t5DtaYTMZXClYgOSe187fNMT+/OPTPyVNjvFNYuruc9s1ULmJ2YqXv3OlHWRi4MxiA4dp\n\tpgVQ==","X-Gm-Message-State":"AMCzsaV/FO5QtmA5AHqmfXcjWbQ5U64D5HGnbZVS+aesCYs/q5RHi8Jj\tajwdtcj5dzDZGli1f6vWnbXK8MsXMhQ5Yg7iwF7ULA==","X-Google-Smtp-Source":"ABhQp+SwAWDyYSaWU3sbSQJSgVD4gNNhIbX/m9A2VfsFzrK/ADKY/G0yv7LPxZ1dft5tp0D/Usb5+GJqD4ubXfuHryg=","X-Received":"by 10.36.154.71 with SMTP id l68mr1712497ite.57.1509127831452;\n\tFri, 27 Oct 2017 11:10:31 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<20171027135259.GG14653@tucnak>","References":"<1d468e04-9f25-65f4-04a1-51b35abb3582@suse.cz>\n\t<20171027105212.GC14653@tucnak>\n\t<63fcd2b6-44d0-cb4b-d518-99eb496c1686@suse.cz>\n\t<20171027112600.GD14653@tucnak>\n\t<c28079ae-8d28-113a-8c02-7e60e86b52bb@suse.cz>\n\t<20171027135259.GG14653@tucnak>","From":"Jason Merrill <jason@redhat.com>","Date":"Fri, 27 Oct 2017 14:10:10 -0400","Message-ID":"<CADzB+2kAqgX6dfhuNvcvAKatjQxRnvxTBQ2ZvD84WRubr_EFWA@mail.gmail.com>","Subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","To":"Jakub Jelinek <jakub@redhat.com>","Cc":"=?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz>,\n\tNathan Sidwell <nathan@acm.org>,\n\tgcc-patches List <gcc-patches@gcc.gnu.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-IsSubscribed":"yes"}},{"id":1795070,"web_url":"http://patchwork.ozlabs.org/comment/1795070/","msgid":"<20171027181831.GH14653@tucnak>","list_archive_url":null,"date":"2017-10-27T18:18:31","subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","submitter":{"id":671,"url":"http://patchwork.ozlabs.org/api/people/671/","name":"Jakub Jelinek","email":"jakub@redhat.com"},"content":"On Fri, Oct 27, 2017 at 02:10:10PM -0400, Jason Merrill wrote:\n> On Fri, Oct 27, 2017 at 9:52 AM, Jakub Jelinek <jakub@redhat.com> wrote:\n> > On Fri, Oct 27, 2017 at 03:48:41PM +0200, Martin Liška wrote:\n> >> --- a/gcc/cp/decl.c\n> >> +++ b/gcc/cp/decl.c\n> >> @@ -14639,8 +14639,12 @@ implicit_default_ctor_p (tree fn)\n> >>  /* Clobber the contents of *this to let the back end know that the object\n> >>     storage is dead when we enter the constructor or leave the destructor.  */\n> >>\n> >> +/* Clobber or zero (depending on CLOBBER_P argument) the contents of *this\n> >> +   to let the back end know that the object storage is dead\n> >> +   when we enter the constructor or leave the destructor.  */\n> >> +\n> >>  static tree\n> >> -build_clobber_this ()\n> >> +build_this_constructor (bool clobber_p)\n> >\n> > I think build_clobber_this is better name, but will defer final review\n> > to Jason or Nathan.  Also, seems there was already a function comment\n> > and you've added yet another one, instead of ammending the first one.\n> \n> Agreed.\n> \n> If the point is to clear the vptr, why are you also clearing the rest\n> of the object?\n\nCan there be multiple vptr pointers in the object or is there just one?\nEven if there can be multiple, perhaps earlier destructors would\nhave cleared those other vptr pointers though.\n\n\tJakub","headers":{"Return-Path":"<gcc-patches-return-465387-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-465387-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"vfgI7w10\"; dkim-atps=neutral","sourceware.org; auth=none","ext-mx04.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx04.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=jakub@redhat.com"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yNsb22gf2z9t48\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 28 Oct 2017 05:19:09 +1100 (AEDT)","(qmail 45155 invoked by alias); 27 Oct 2017 18:18:58 -0000","(qmail 44412 invoked by uid 89); 27 Oct 2017 18:18:40 -0000","from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 27 Oct 2017 18:18:39 +0000","from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com\n\t[10.5.11.12])\t(using TLSv1.2 with cipher AECDH-AES256-SHA\n\t(256/256 bits))\t(No client certificate requested)\tby\n\tmx1.redhat.com (Postfix) with ESMTPS id 2F35880463;\n\tFri, 27 Oct 2017 18:18:38 +0000 (UTC)","from tucnak.zalov.cz (ovpn-116-247.ams2.redhat.com\n\t[10.36.116.247])\tby smtp.corp.redhat.com (Postfix) with\n\tESMTPS id BD3D160BE4; Fri, 27 Oct 2017 18:18:37 +0000 (UTC)","from tucnak.zalov.cz (localhost [127.0.0.1])\tby tucnak.zalov.cz\n\t(8.15.2/8.15.2) with ESMTP id v9RIIYJS005134;\n\tFri, 27 Oct 2017 20:18:34 +0200","(from jakub@localhost)\tby tucnak.zalov.cz (8.15.2/8.15.2/Submit)\n\tid v9RIIV1a002233; Fri, 27 Oct 2017 20:18:31 +0200"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:reply-to:references:mime-version\n\t:content-type:content-transfer-encoding:in-reply-to; q=dns; s=\n\tdefault; b=C93WfKJv3AShYW9RJ9r785BYdgAM33j4E7WUCijh6+Fq/xNtM+KvQ\n\tl3zTc2Lw8EpI/BJhsifl0rggvSi7BmoPIwNmv90gfAM5BJiupeh1lINtfUF04qnz\n\tQ7BnG9PivQdU5H4h1RvburEiOuXrLfrj7fA8gHtdfIaz8O2gYQMO1k=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:reply-to:references:mime-version\n\t:content-type:content-transfer-encoding:in-reply-to; s=default;\n\tbh=1fyDmu2iDgsz4O43H6y/AwiGmlQ=; b=vfgI7w10yA6mAErj0Ht88YDS8RWw\n\tDuEDmrnCfJLlpTYMa4l8Ns739txKWGtHTngtaAKieT5vvvAC9/2VTmfnv2Pq93Nt\n\tZ69e3v3rz3PQi24mSzRBk4i8h0WwRoPSzzidbyrcbb/N8yk5RjDtv/VKrEss07RI\n\tmy9LlYpqahaWNDw=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2,\n\tGIT_PATCH_3, RP_MATCHES_RCVD,\n\tSPF_HELO_PASS autolearn=ham version=3.3.2 spammy=","X-HELO":"mx1.redhat.com","DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 2F35880463","Date":"Fri, 27 Oct 2017 20:18:31 +0200","From":"Jakub Jelinek <jakub@redhat.com>","To":"Jason Merrill <jason@redhat.com>","Cc":"Martin =?utf-8?b?TGnFoWth?=\n\t<mliska@suse.cz>, Nathan Sidwell <nathan@acm.org>,\n\tgcc-patches List <gcc-patches@gcc.gnu.org>","Subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","Message-ID":"<20171027181831.GH14653@tucnak>","Reply-To":"Jakub Jelinek <jakub@redhat.com>","References":"<1d468e04-9f25-65f4-04a1-51b35abb3582@suse.cz>\n\t<20171027105212.GC14653@tucnak>\n\t<63fcd2b6-44d0-cb4b-d518-99eb496c1686@suse.cz>\n\t<20171027112600.GD14653@tucnak>\n\t<c28079ae-8d28-113a-8c02-7e60e86b52bb@suse.cz>\n\t<20171027135259.GG14653@tucnak>\n\t<CADzB+2kAqgX6dfhuNvcvAKatjQxRnvxTBQ2ZvD84WRubr_EFWA@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<CADzB+2kAqgX6dfhuNvcvAKatjQxRnvxTBQ2ZvD84WRubr_EFWA@mail.gmail.com>","User-Agent":"Mutt/1.7.1 (2016-10-04)","X-IsSubscribed":"yes"}},{"id":1795080,"web_url":"http://patchwork.ozlabs.org/comment/1795080/","msgid":"<a0aaef40-f741-034d-10cb-45fedc4616f7@acm.org>","list_archive_url":null,"date":"2017-10-27T18:30:39","subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","submitter":{"id":9970,"url":"http://patchwork.ozlabs.org/api/people/9970/","name":"Nathan Sidwell","email":"nathan@acm.org"},"content":"On 10/27/2017 02:18 PM, Jakub Jelinek wrote:\n> On Fri, Oct 27, 2017 at 02:10:10PM -0400, Jason Merrill wrote:\n\n>> If the point is to clear the vptr, why are you also clearing the rest\n>> of the object?\n> \n> Can there be multiple vptr pointers in the object or is there just one?\n> Even if there can be multiple, perhaps earlier destructors would\n> have cleared those other vptr pointers though.\n\nThere can be multiple vptrs in an object (multiple polymorphic bases). \nHowever, each such case will have its own base dtor invoked, as you \npostulated.  In fact, there may be a base dtor invoked that maps onto \nthe single vptr, in the cases when we're singly inheriting a polymorphic \nbase.\n\nnathan\n\n[polymorphic here includes the case of having virtual bases].","headers":{"Return-Path":"<gcc-patches-return-465389-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-465389-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"NCqUUpdl\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yNsrZ26Qvz9sxR\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 28 Oct 2017 05:30:52 +1100 (AEDT)","(qmail 11661 invoked by alias); 27 Oct 2017 18:30:45 -0000","(qmail 11640 invoked by uid 89); 27 Oct 2017 18:30:44 -0000","from mail-yw0-f177.google.com (HELO mail-yw0-f177.google.com)\n\t(209.85.161.177) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 27 Oct 2017 18:30:43 +0000","by mail-yw0-f177.google.com with SMTP id y75so6519689ywg.0 for\n\t<gcc-patches@gcc.gnu.org>; Fri, 27 Oct 2017 11:30:42 -0700 (PDT)","from ?IPv6:2620:10d:c0a3:20fb:7500:e7fb:4a6f:2254?\n\t([2620:10d:c091:200::3b0e]) by smtp.googlemail.com with\n\tESMTPSA id f200sm4173872ywb.23.2017.10.27.11.30.39\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256\n\tbits=128/128); Fri, 27 Oct 2017 11:30:40 -0700 (PDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type:content-transfer-encoding; q=dns; s=\n\tdefault; b=lv6oWFmdZ7iYhte412r/jdBpZlq5IKvwaEvqED74FED+iOfz0DQhz\n\t1yjtlaWl6toKSUbEN9qNMUOkr3Gc8TInKDK7ddQuNaiX15wI0awNa3aRKw7iatkb\n\tLfpjOhsutzCSXH1jXrLgrvAwXEaurRC7otWYrd9UKWbSLi1kRPv2x8=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type:content-transfer-encoding; s=default;\n\tbh=TyMHLsolhe4bMqrqOsQ6Ca6a1kI=; b=NCqUUpdl9a4XQ3fG79Kgt3AxWiCz\n\tNIQvXUo8VjRrd33JlWr128R8epYXExU4bn3+NXK/fL9RSuvYwJof+Ag/4swqCO0z\n\t5jHGJmNFi0qBCkO051OyHlj5MyRYVoOT6DvB0NpCqcngS7itzcU83Vmky6ZkPayv\n\tTUNDC35PZsmRtTA=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-1.4 required=5.0 tests=BAYES_00,\n\tFREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM,\n\tSPF_PASS autolearn=no version=3.3.2 spammy=","X-HELO":"mail-yw0-f177.google.com","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:sender:subject:to:cc:references:from:message-id\n\t:date:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=y918Us5JHBfZKlB7NCoxxyWX6VWXizhROx8zaXZI7hc=;\n\tb=N6wIRevOdSXa1IRy5xasIbRSi+joVVgLHYRZMKQLWQ3//rg32F+9heYqCptC72FxtO\n\tfTMdVswxXMvLgW1uwM4RG4EMQfPM4asYHZWLTqTsEPTJuzMT1AidWw5uNDfOMwLXhEWV\n\tJSYr1L7LbIeyo/kof09GOPC8kB0UA/tT1yd+K7QY29ab2cJoPrj28eawYixXaGSQ5hYr\n\tNe7rW6eX1xHxZ+vmgsFdD+N4HcsXS5PO4LhBYlXUyRk5ZEGN3cU8/bDFnp4ZTU+3QMLt\n\tdXYt9X7p/W8LA82mFiTydTqU/oa3qdAyLcrNeSAy2z0OkTD9ui/IGUVCUaO5njJ7VMcy\n\tG/8A==","X-Gm-Message-State":"AMCzsaULeOEoU4x9rai96nis4Dj9Huf1v+68PSwffgRLABO/jjhZnglL\tpy2oyRsErYk8I9TI26VI2BU=","X-Google-Smtp-Source":"ABhQp+QWMGRjp7JtOwVtimMyR4TLD9JILfm5dYv5kM3wmr4qI4jkUgi/Fe8cnRlMbVsOf1fmkKoO9w==","X-Received":"by 10.37.176.1 with SMTP id q1mr957776ybf.291.1509129040988;\n\tFri, 27 Oct 2017 11:30:40 -0700 (PDT)","Subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","To":"Jakub Jelinek <jakub@redhat.com>, Jason Merrill <jason@redhat.com>","Cc":"=?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz>,\n\tgcc-patches List <gcc-patches@gcc.gnu.org>","References":"<1d468e04-9f25-65f4-04a1-51b35abb3582@suse.cz>\n\t<20171027105212.GC14653@tucnak>\n\t<63fcd2b6-44d0-cb4b-d518-99eb496c1686@suse.cz>\n\t<20171027112600.GD14653@tucnak>\n\t<c28079ae-8d28-113a-8c02-7e60e86b52bb@suse.cz>\n\t<20171027135259.GG14653@tucnak>\n\t<CADzB+2kAqgX6dfhuNvcvAKatjQxRnvxTBQ2ZvD84WRubr_EFWA@mail.gmail.com>\n\t<20171027181831.GH14653@tucnak>","From":"Nathan Sidwell <nathan@acm.org>","Message-ID":"<a0aaef40-f741-034d-10cb-45fedc4616f7@acm.org>","Date":"Fri, 27 Oct 2017 14:30:39 -0400","User-Agent":"Mozilla/5.0 (X11; Linux x86_64;\n\trv:52.0) Gecko/20100101 Thunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20171027181831.GH14653@tucnak>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Transfer-Encoding":"7bit"}},{"id":1795083,"web_url":"http://patchwork.ozlabs.org/comment/1795083/","msgid":"<20171027183428.GI14653@tucnak>","list_archive_url":null,"date":"2017-10-27T18:34:28","subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","submitter":{"id":671,"url":"http://patchwork.ozlabs.org/api/people/671/","name":"Jakub Jelinek","email":"jakub@redhat.com"},"content":"On Fri, Oct 27, 2017 at 02:30:39PM -0400, Nathan Sidwell wrote:\n> On 10/27/2017 02:18 PM, Jakub Jelinek wrote:\n> > On Fri, Oct 27, 2017 at 02:10:10PM -0400, Jason Merrill wrote:\n> \n> > > If the point is to clear the vptr, why are you also clearing the rest\n> > > of the object?\n> > \n> > Can there be multiple vptr pointers in the object or is there just one?\n> > Even if there can be multiple, perhaps earlier destructors would\n> > have cleared those other vptr pointers though.\n> \n> There can be multiple vptrs in an object (multiple polymorphic bases).\n> However, each such case will have its own base dtor invoked, as you\n> postulated.  In fact, there may be a base dtor invoked that maps onto the\n> single vptr, in the cases when we're singly inheriting a polymorphic base.\n\nBut when singly inheriting a polymorphic base and thus mapped to the same\nvptr all but the last dtor will not be in charge, right?\nSo, if using build_clobber_this for this, instead of clobbering what we\nclobber we'd just clear the single vptr (couldn't clobber the rest, even\nif before the store, because that would make the earlier other vptr stores\ndead).\n\n\tJakub","headers":{"Return-Path":"<gcc-patches-return-465390-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-465390-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"WxzgD6wB\"; dkim-atps=neutral","sourceware.org; auth=none","ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=jakub@redhat.com"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yNswz6qYSz9sxR\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 28 Oct 2017 05:34:43 +1100 (AEDT)","(qmail 16639 invoked by alias); 27 Oct 2017 18:34:36 -0000","(qmail 16625 invoked by uid 89); 27 Oct 2017 18:34:35 -0000","from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 27 Oct 2017 18:34:34 +0000","from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.phx2.redhat.com\n\t[10.5.11.14])\t(using TLSv1.2 with cipher AECDH-AES256-SHA\n\t(256/256 bits))\t(No client certificate requested)\tby\n\tmx1.redhat.com (Postfix) with ESMTPS id 705F65D685;\n\tFri, 27 Oct 2017 18:34:33 +0000 (UTC)","from tucnak.zalov.cz (ovpn-116-247.ams2.redhat.com\n\t[10.36.116.247])\tby smtp.corp.redhat.com (Postfix) with\n\tESMTPS id 182245D9C0; Fri, 27 Oct 2017 18:34:32 +0000 (UTC)","from tucnak.zalov.cz (localhost [127.0.0.1])\tby tucnak.zalov.cz\n\t(8.15.2/8.15.2) with ESMTP id v9RIYUhq028827;\n\tFri, 27 Oct 2017 20:34:30 +0200","(from jakub@localhost)\tby tucnak.zalov.cz (8.15.2/8.15.2/Submit)\n\tid v9RIYS2j028826; Fri, 27 Oct 2017 20:34:28 +0200"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:reply-to:references:mime-version\n\t:content-type:in-reply-to; q=dns; s=default; b=A/0/9AqpohKLnT3nD\n\t7WOFKfj6+ApYYGoLFyxTpgUqN00WIlSjGG+LbilSUJ/24rkWAkDICBjrTbOu5EHI\n\tx8pYaBXDIaI1O0YaVh7GbuCmBzvZAzMIYEM+xCPZ9TYouuPQPy2XcpQBImMVS2oT\n\t2z4gdZjaJQb0ZnzhZ96XaUxPtI=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:reply-to:references:mime-version\n\t:content-type:in-reply-to; s=default; bh=+yegBSJOMxNL1PahVbbe9ri\n\tiykE=; b=WxzgD6wBnrPnV/J79wV++5PJnSZHjdxvFdnJ6de6XZ3WD7+xJnhhXV8\n\tlaABR+LZJw8Buv511SDVeSclueHap10ELFnmn69uKt1fpf4Iwvd4CG+2iK8qIk+q\n\tVGtgKwcdyT+VBm6uI4CQIlV0M83Ku/n9H8wxby6QQGaz+nNflr6A=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-1.9 required=5.0 tests=BAYES_00,\n\tRP_MATCHES_RCVD,\n\tSPF_HELO_PASS autolearn=ham version=3.3.2 spammy=charge","X-HELO":"mx1.redhat.com","DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 705F65D685","Date":"Fri, 27 Oct 2017 20:34:28 +0200","From":"Jakub Jelinek <jakub@redhat.com>","To":"Nathan Sidwell <nathan@acm.org>","Cc":"Jason Merrill <jason@redhat.com>,        Martin =?utf-8?b?TGnFoWth?=\n\t<mliska@suse.cz>, gcc-patches List <gcc-patches@gcc.gnu.org>","Subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","Message-ID":"<20171027183428.GI14653@tucnak>","Reply-To":"Jakub Jelinek <jakub@redhat.com>","References":"<1d468e04-9f25-65f4-04a1-51b35abb3582@suse.cz>\n\t<20171027105212.GC14653@tucnak>\n\t<63fcd2b6-44d0-cb4b-d518-99eb496c1686@suse.cz>\n\t<20171027112600.GD14653@tucnak>\n\t<c28079ae-8d28-113a-8c02-7e60e86b52bb@suse.cz>\n\t<20171027135259.GG14653@tucnak>\n\t<CADzB+2kAqgX6dfhuNvcvAKatjQxRnvxTBQ2ZvD84WRubr_EFWA@mail.gmail.com>\n\t<20171027181831.GH14653@tucnak>\n\t<a0aaef40-f741-034d-10cb-45fedc4616f7@acm.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<a0aaef40-f741-034d-10cb-45fedc4616f7@acm.org>","User-Agent":"Mutt/1.7.1 (2016-10-04)","X-IsSubscribed":"yes"}},{"id":1795095,"web_url":"http://patchwork.ozlabs.org/comment/1795095/","msgid":"<3ee8c949-aa07-a998-a082-34fb2b4f5c73@acm.org>","list_archive_url":null,"date":"2017-10-27T19:44:48","subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","submitter":{"id":9970,"url":"http://patchwork.ozlabs.org/api/people/9970/","name":"Nathan Sidwell","email":"nathan@acm.org"},"content":"On 10/27/2017 02:34 PM, Jakub Jelinek wrote:\n\n> But when singly inheriting a polymorphic base and thus mapped to the same\n> vptr all but the last dtor will not be in charge, right?\n\nCorrect.\n\n> So, if using build_clobber_this for this, instead of clobbering what we\n> clobber we'd just clear the single vptr (couldn't clobber the rest, even\n> if before the store, because that would make the earlier other vptr stores\n> dead).\n\nok (I'd not looked at the patch to see if in chargeness was signficant)\n\nnathan","headers":{"Return-Path":"<gcc-patches-return-465392-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-465392-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"KEU9Sw+O\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yNvV74qC7z9s7M\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 28 Oct 2017 06:45:01 +1100 (AEDT)","(qmail 25208 invoked by alias); 27 Oct 2017 19:44:53 -0000","(qmail 22987 invoked by uid 89); 27 Oct 2017 19:44:52 -0000","from mail-yw0-f182.google.com (HELO mail-yw0-f182.google.com)\n\t(209.85.161.182) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 27 Oct 2017 19:44:51 +0000","by mail-yw0-f182.google.com with SMTP id j4so6677482ywb.2 for\n\t<gcc-patches@gcc.gnu.org>; Fri, 27 Oct 2017 12:44:51 -0700 (PDT)","from ?IPv6:2620:10d:c0a3:20fb:7500:e7fb:4a6f:2254?\n\t([2620:10d:c091:200::1:20de]) by smtp.googlemail.com with\n\tESMTPSA id a190sm1527266ywf.85.2017.10.27.12.44.48\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256\n\tbits=128/128); Fri, 27 Oct 2017 12:44:48 -0700 (PDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type:content-transfer-encoding; q=dns; s=\n\tdefault; b=mO8yEk9JDUy1VVA/ZJ20WyvZ5BXJxF1SZujCGen22bLesZhG+enl7\n\tApLUaMef5zXLV62pvz74fl8w67tzBcHFlAytbyu18sdv5jePHOwx/CQkmx/IR/Eq\n\tjusT/zE1fyY5diKCHiiSgirdEHXSPAyuYEYQeRnel2HSlCrZ8aS+CE=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type:content-transfer-encoding; s=default;\n\tbh=aH0ZA03j1uGdigzUZ00QVZwqNF8=; b=KEU9Sw+OSHUueu7VgVO/3/WJn+wc\n\twMHvpK4DpWzmDyeeh9g4egV5Sv0Ub2I4JNPqn+whm0f1SKFINunbwq1yVB8c1tYC\n\t9HAxdWWoOqT95U8DXwqkrpSYigMvIcaB6gpzZj70MHYM9qwlrjSPbyi5NwZKtfep\n\tkjiGRiiz17vOOBA=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-1.4 required=5.0 tests=BAYES_00,\n\tFREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM,\n\tSPF_PASS autolearn=no version=3.3.2 spammy=charge","X-HELO":"mail-yw0-f182.google.com","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:sender:subject:to:cc:references:from:message-id\n\t:date:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=Oy8si91kK90XMrpt+BTF33vIAs1c05mroj0GQayfW98=;\n\tb=OuXSVdwO5NzT3ZPMWpJ/nrwIrbl7MID6fxMsYsomJEdLyYopfJSadu2bt7/LTA70wU\n\t1snd0sGKWjTxvvL56YYiknXfCnkK7A8IWZ57ezRrmvB36WEmIjtchpJK6yJnSYkE7wND\n\tEmjg+WyHSSOpdHTkM9Qs7P+e6ShKefyOTKQ16Zco05mdOXkBXr7keVZmZxylV7v+aenr\n\t1TodKJSqgjn6kL1VyF130FRGfHbm5ihs1I1Tfuk3UcIJIg+IDICsmUeUgAp7FhItQH6m\n\t8wo8Ca/KiO1N24zcn15xT6UqFb1ddVnvzm+KQghbRza1yf3Se4d8w0hd2du9CjvkFiHl\n\tUz9g==","X-Gm-Message-State":"AMCzsaVD1baPRRt5imG/inT6FqC3Yn2rZufEHLjjk6NdZFljobs4muoZ\tiPB+1eF1mW7rNCKEJcrzT0c=","X-Google-Smtp-Source":"ABhQp+TG4Ny4KqcLqefRetyS/uwnMOJjy2x+znQ/t85Q39nPsH5hzbMRVQaShTDNHiTG0qQsdCKFCA==","X-Received":"by 10.37.190.201 with SMTP id k9mr1075516ybm.68.1509133489622;\n\tFri, 27 Oct 2017 12:44:49 -0700 (PDT)","Subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","To":"Jakub Jelinek <jakub@redhat.com>","Cc":"Jason Merrill <jason@redhat.com>, =?utf-8?q?Martin_Li=C5=A1ka?=\n\t<mliska@suse.cz>, gcc-patches List <gcc-patches@gcc.gnu.org>","References":"<1d468e04-9f25-65f4-04a1-51b35abb3582@suse.cz>\n\t<20171027105212.GC14653@tucnak>\n\t<63fcd2b6-44d0-cb4b-d518-99eb496c1686@suse.cz>\n\t<20171027112600.GD14653@tucnak>\n\t<c28079ae-8d28-113a-8c02-7e60e86b52bb@suse.cz>\n\t<20171027135259.GG14653@tucnak>\n\t<CADzB+2kAqgX6dfhuNvcvAKatjQxRnvxTBQ2ZvD84WRubr_EFWA@mail.gmail.com>\n\t<20171027181831.GH14653@tucnak>\n\t<a0aaef40-f741-034d-10cb-45fedc4616f7@acm.org>\n\t<20171027183428.GI14653@tucnak>","From":"Nathan Sidwell <nathan@acm.org>","Message-ID":"<3ee8c949-aa07-a998-a082-34fb2b4f5c73@acm.org>","Date":"Fri, 27 Oct 2017 15:44:48 -0400","User-Agent":"Mozilla/5.0 (X11; Linux x86_64;\n\trv:52.0) Gecko/20100101 Thunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20171027183428.GI14653@tucnak>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Transfer-Encoding":"7bit"}},{"id":1798635,"web_url":"http://patchwork.ozlabs.org/comment/1798635/","msgid":"<f6376de4-a151-3f22-afa8-c357f73c3c11@suse.cz>","list_archive_url":null,"date":"2017-11-03T14:25:25","subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","submitter":{"id":62010,"url":"http://patchwork.ozlabs.org/api/people/62010/","name":"Martin Liška","email":"mliska@suse.cz"},"content":"On 10/27/2017 09:44 PM, Nathan Sidwell wrote:\n> On 10/27/2017 02:34 PM, Jakub Jelinek wrote:\n> \n>> But when singly inheriting a polymorphic base and thus mapped to the same\n>> vptr all but the last dtor will not be in charge, right?\n> \n> Correct.\n> \n>> So, if using build_clobber_this for this, instead of clobbering what we\n>> clobber we'd just clear the single vptr (couldn't clobber the rest, even\n>> if before the store, because that would make the earlier other vptr stores\n>> dead).\n> \n> ok (I'd not looked at the patch to see if in chargeness was signficant)\n> \n> nathan\n> \n\nHello.\n\nI'm sending v2 which only zeros vptr of object.\n\nReady to be installed after finishing tests?\nMartin\nFrom 098932be5472656c834b402038accb0b861afcc1 Mon Sep 17 00:00:00 2001\nFrom: marxin <mliska@suse.cz>\nDate: Thu, 19 Oct 2017 11:10:19 +0200\nSubject: [PATCH] Zero vptr in dtor for -fsanitize=vptr.\n\ngcc/cp/ChangeLog:\n\n2017-11-03  Martin Liska  <mliska@suse.cz>\n\n\t* decl.c (begin_destructor_body): In case of VPTR sanitization\n\t(with disabled recovery), zero vptr in order to catch virtual calls\n\tafter lifetime of an object.\n\ngcc/testsuite/ChangeLog:\n\n2017-10-27  Martin Liska  <mliska@suse.cz>\n\n\t* g++.dg/ubsan/vptr-12.C: New test.\n---\n gcc/cp/decl.c                        | 20 +++++++++++++++++++-\n gcc/testsuite/g++.dg/ubsan/vptr-12.C | 22 ++++++++++++++++++++++\n 2 files changed, 41 insertions(+), 1 deletion(-)\n create mode 100644 gcc/testsuite/g++.dg/ubsan/vptr-12.C\n\ndiff --git a/gcc/cp/decl.c b/gcc/cp/decl.c\nindex d88c78f348b..d45cc29e636 100644\n--- a/gcc/cp/decl.c\n+++ b/gcc/cp/decl.c\n@@ -15241,7 +15241,25 @@ begin_destructor_body (void)\n       if (flag_lifetime_dse\n \t  /* Clobbering an empty base is harmful if it overlays real data.  */\n \t  && !is_empty_class (current_class_type))\n-\tfinish_decl_cleanup (NULL_TREE, build_clobber_this ());\n+      {\n+\t  if (sanitize_flags_p (SANITIZE_VPTR)\n+\t      && (flag_sanitize_recover & SANITIZE_VPTR) == 0)\n+\t    {\n+\t      tree binfo = TYPE_BINFO (current_class_type);\n+\t      tree ref\n+\t\t= cp_build_indirect_ref (current_class_ptr, RO_NULL,\n+\t\t\t\t\t tf_warning_or_error);\n+\n+\t      tree vtbl_ptr = build_vfield_ref (ref, TREE_TYPE (binfo));\n+\t      tree vtbl = build_zero_cst (TREE_TYPE (vtbl_ptr));\n+\t      tree stmt = cp_build_modify_expr (input_location, vtbl_ptr,\n+\t\t\t\t\t\tNOP_EXPR, vtbl,\n+\t\t\t\t\t\ttf_warning_or_error);\n+\t      finish_decl_cleanup (NULL_TREE, stmt);\n+\t    }\n+\t  else\n+\t    finish_decl_cleanup (NULL_TREE, build_clobber_this ());\n+      }\n \n       /* And insert cleanups for our bases and members so that they\n \t will be properly destroyed if we throw.  */\ndiff --git a/gcc/testsuite/g++.dg/ubsan/vptr-12.C b/gcc/testsuite/g++.dg/ubsan/vptr-12.C\nnew file mode 100644\nindex 00000000000..be5c074dfc1\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/ubsan/vptr-12.C\n@@ -0,0 +1,22 @@\n+// { dg-do run }\n+// { dg-shouldfail \"ubsan\" }\n+// { dg-options \"-fsanitize=vptr -fno-sanitize-recover=vptr\" }\n+\n+struct MyClass\n+{\n+  virtual ~MyClass () {}\n+  virtual void Doit () {}\n+};\n+\n+int\n+main ()\n+{\n+  MyClass *c = new MyClass;\n+  c->~MyClass ();\n+  c->Doit ();\n+\n+  return 0;\n+}\n+\n+// { dg-output \"\\[^\\n\\r]*vptr-12.C:16:\\[0-9]*: runtime error: member call on address 0x\\[0-9a-fA-F]* which does not point to an object of type 'MyClass'(\\n|\\r\\n|\\r)\" }\n+// { dg-output \"0x\\[0-9a-fA-F]*: note: object has invalid vptr(\\n|\\r\\n|\\r)\" }","headers":{"Return-Path":"<gcc-patches-return-465854-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-465854-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"sMy81XPo\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yT44L346Gz9sBd\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  4 Nov 2017 01:25:37 +1100 (AEDT)","(qmail 35320 invoked by alias); 3 Nov 2017 14:25:29 -0000","(qmail 35310 invoked by uid 89); 3 Nov 2017 14:25:29 -0000","from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 03 Nov 2017 14:25:27 +0000","from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254])\tby\n\tmx2.suse.de (Postfix) with ESMTP id 8DB0AAD09;\n\tFri,  3 Nov 2017 14:25:25 +0000 (UTC)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type; q=dns; s=default; b=UjlOhJ1sglAQJG4bT\n\tIfLQ7PjKrrvxg/7UA9gsVIInbfOfIM7dALx5SLctGg5RmPxAVNbP3KwDzlvqd+8T\n\tIJ2Sm9UXffEmR4+qR2lKkGFaj5aZRMLZIUAB8Tm7PKs3DLdYHltyPGvjlyqAAWSw\n\t+8fq/25w8kcYeziZIjVt2ifVLw=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type; s=default; bh=F+TcyAsF/mhAL6H7HW8PLon\n\t6oIg=; b=sMy81XPoQWzp0V2F3DgnkPqR42HmqhSp3I51+PPHAOMhJnpp789Z37A\n\tg0NMqkRIQQiMU4BRqIJBMikj7jLU43vsNAvOOyjVxXdipo9hTT1Z8783ZyXgRVry\n\tejuZzP60PLo7Rw/Gr22sifSjVvj3gkgwBoyT4x3wUy/c0Z7dQ0Ec=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=inheriting, charge","X-HELO":"mx2.suse.de","Subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","To":"Nathan Sidwell <nathan@acm.org>, Jakub Jelinek <jakub@redhat.com>","Cc":"Jason Merrill <jason@redhat.com>,\n\tgcc-patches List <gcc-patches@gcc.gnu.org>","References":"<1d468e04-9f25-65f4-04a1-51b35abb3582@suse.cz>\n\t<20171027105212.GC14653@tucnak>\n\t<63fcd2b6-44d0-cb4b-d518-99eb496c1686@suse.cz>\n\t<20171027112600.GD14653@tucnak>\n\t<c28079ae-8d28-113a-8c02-7e60e86b52bb@suse.cz>\n\t<20171027135259.GG14653@tucnak>\n\t<CADzB+2kAqgX6dfhuNvcvAKatjQxRnvxTBQ2ZvD84WRubr_EFWA@mail.gmail.com>\n\t<20171027181831.GH14653@tucnak>\n\t<a0aaef40-f741-034d-10cb-45fedc4616f7@acm.org>\n\t<20171027183428.GI14653@tucnak>\n\t<3ee8c949-aa07-a998-a082-34fb2b4f5c73@acm.org>","From":"=?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz>","Message-ID":"<f6376de4-a151-3f22-afa8-c357f73c3c11@suse.cz>","Date":"Fri, 3 Nov 2017 15:25:25 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64;\n\trv:52.0) Gecko/20100101 Thunderbird/52.4.0","MIME-Version":"1.0","In-Reply-To":"<3ee8c949-aa07-a998-a082-34fb2b4f5c73@acm.org>","Content-Type":"multipart/mixed;\n\tboundary=\"------------100AAE208BC0F45DF45DC28F\"","X-IsSubscribed":"yes"}},{"id":1798646,"web_url":"http://patchwork.ozlabs.org/comment/1798646/","msgid":"<20171103143112.GM8422@redhat.com>","list_archive_url":null,"date":"2017-11-03T14:31:12","subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","submitter":{"id":14370,"url":"http://patchwork.ozlabs.org/api/people/14370/","name":"Marek Polacek","email":"polacek@redhat.com"},"content":"On Fri, Nov 03, 2017 at 03:25:25PM +0100, Martin Liška wrote:\n> On 10/27/2017 09:44 PM, Nathan Sidwell wrote:\n> > On 10/27/2017 02:34 PM, Jakub Jelinek wrote:\n> > \n> >> But when singly inheriting a polymorphic base and thus mapped to the same\n> >> vptr all but the last dtor will not be in charge, right?\n> > \n> > Correct.\n> > \n> >> So, if using build_clobber_this for this, instead of clobbering what we\n> >> clobber we'd just clear the single vptr (couldn't clobber the rest, even\n> >> if before the store, because that would make the earlier other vptr stores\n> >> dead).\n> > \n> > ok (I'd not looked at the patch to see if in chargeness was signficant)\n> > \n> > nathan\n> > \n> \n> Hello.\n> \n> I'm sending v2 which only zeros vptr of object.\n> \n> Ready to be installed after finishing tests?\n> Martin\n\n> From 098932be5472656c834b402038accb0b861afcc1 Mon Sep 17 00:00:00 2001\n> From: marxin <mliska@suse.cz>\n> Date: Thu, 19 Oct 2017 11:10:19 +0200\n> Subject: [PATCH] Zero vptr in dtor for -fsanitize=vptr.\n> \n> gcc/cp/ChangeLog:\n> \n> 2017-11-03  Martin Liska  <mliska@suse.cz>\n> \n> \t* decl.c (begin_destructor_body): In case of VPTR sanitization\n> \t(with disabled recovery), zero vptr in order to catch virtual calls\n> \tafter lifetime of an object.\n> \n> gcc/testsuite/ChangeLog:\n> \n> 2017-10-27  Martin Liska  <mliska@suse.cz>\n> \n> \t* g++.dg/ubsan/vptr-12.C: New test.\n> ---\n>  gcc/cp/decl.c                        | 20 +++++++++++++++++++-\n>  gcc/testsuite/g++.dg/ubsan/vptr-12.C | 22 ++++++++++++++++++++++\n>  2 files changed, 41 insertions(+), 1 deletion(-)\n>  create mode 100644 gcc/testsuite/g++.dg/ubsan/vptr-12.C\n> \n> diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c\n> index d88c78f348b..d45cc29e636 100644\n> --- a/gcc/cp/decl.c\n> +++ b/gcc/cp/decl.c\n> @@ -15241,7 +15241,25 @@ begin_destructor_body (void)\n>        if (flag_lifetime_dse\n>  \t  /* Clobbering an empty base is harmful if it overlays real data.  */\n>  \t  && !is_empty_class (current_class_type))\n> -\tfinish_decl_cleanup (NULL_TREE, build_clobber_this ());\n> +      {\n> +\t  if (sanitize_flags_p (SANITIZE_VPTR)\n> +\t      && (flag_sanitize_recover & SANITIZE_VPTR) == 0)\n> +\t    {\n> +\t      tree binfo = TYPE_BINFO (current_class_type);\n> +\t      tree ref\n> +\t\t= cp_build_indirect_ref (current_class_ptr, RO_NULL,\n> +\t\t\t\t\t tf_warning_or_error);\n> +\n> +\t      tree vtbl_ptr = build_vfield_ref (ref, TREE_TYPE (binfo));\n> +\t      tree vtbl = build_zero_cst (TREE_TYPE (vtbl_ptr));\n> +\t      tree stmt = cp_build_modify_expr (input_location, vtbl_ptr,\n> +\t\t\t\t\t\tNOP_EXPR, vtbl,\n> +\t\t\t\t\t\ttf_warning_or_error);\n> +\t      finish_decl_cleanup (NULL_TREE, stmt);\n> +\t    }\n> +\t  else\n> +\t    finish_decl_cleanup (NULL_TREE, build_clobber_this ());\n> +      }\n>  \n>        /* And insert cleanups for our bases and members so that they\n>  \t will be properly destroyed if we throw.  */\n> diff --git a/gcc/testsuite/g++.dg/ubsan/vptr-12.C b/gcc/testsuite/g++.dg/ubsan/vptr-12.C\n> new file mode 100644\n> index 00000000000..be5c074dfc1\n> --- /dev/null\n> +++ b/gcc/testsuite/g++.dg/ubsan/vptr-12.C\n> @@ -0,0 +1,22 @@\n> +// { dg-do run }\n> +// { dg-shouldfail \"ubsan\" }\n> +// { dg-options \"-fsanitize=vptr -fno-sanitize-recover=vptr\" }\n> +\n> +struct MyClass\n> +{\n> +  virtual ~MyClass () {}\n> +  virtual void Doit () {}\n> +};\n> +\n> +int\n> +main ()\n> +{\n> +  MyClass *c = new MyClass;\n> +  c->~MyClass ();\n> +  c->Doit ();\n> +\n> +  return 0;\n> +}\n> +\n> +// { dg-output \"\\[^\\n\\r]*vptr-12.C:16:\\[0-9]*: runtime error: member call on address 0x\\[0-9a-fA-F]* which does not point to an object of type 'MyClass'(\\n|\\r\\n|\\r)\" }\n> +// { dg-output \"0x\\[0-9a-fA-F]*: note: object has invalid vptr(\\n|\\r\\n|\\r)\" }\n\nI think the last dg-output shouldn't have any regexps at the end, so:\n\n// { dg-output \"0x\\[0-9a-fA-F]*: note: object has invalid vptr\" }\n\n\tMarek","headers":{"Return-Path":"<gcc-patches-return-465855-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-465855-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"rfA+nPRh\"; dkim-atps=neutral","sourceware.org; auth=none","ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=polacek@redhat.com"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yT4CB20Rqz9sPk\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  4 Nov 2017 01:31:32 +1100 (AEDT)","(qmail 130656 invoked by alias); 3 Nov 2017 14:31:23 -0000","(qmail 129153 invoked by uid 89); 3 Nov 2017 14:31:22 -0000","from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 03 Nov 2017 14:31:20 +0000","from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com\n\t[10.5.11.12])\t(using TLSv1.2 with cipher AECDH-AES256-SHA\n\t(256/256 bits))\t(No client certificate requested)\tby\n\tmx1.redhat.com (Postfix) with ESMTPS id ABADBC0467C4;\n\tFri,  3 Nov 2017 14:31:18 +0000 (UTC)","from redhat.com (ovpn-204-69.brq.redhat.com [10.40.204.69])\tby\n\tsmtp.corp.redhat.com (Postfix) with ESMTPS id A060160BE0;\n\tFri,  3 Nov 2017 14:31:16 +0000 (UTC)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:references:mime-version\n\t:content-type:content-transfer-encoding:in-reply-to; q=dns; s=\n\tdefault; b=yBDelIqK3yc2uzxy5xwkOLARBoUtSqIyFRM4gJZEAVMcwrkuNWTIi\n\tSlFUQXyNsC89Fmgbg/UFR6jyQeTDoGHzI5bzTsMVPKRCzOocXEw5md8QC/dyKGtc\n\twx4U3l8xvhmdho5wg7IRofBSSaCsPpbSsu7x82+zX2FSoFnbXcCcM8=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:references:mime-version\n\t:content-type:content-transfer-encoding:in-reply-to; s=default;\n\tbh=hs29VUVJJMvSsQxkbwjXV+DFn2k=; b=rfA+nPRhlJe2MSoxq3SZ5cNZQyVE\n\tWcdNa+Jdg3vDAfHYu+vEE7Im62SpIHR29tH/DvkN3rpUgNxVLmt73kThhBFloORk\n\txXmJtcpycPz2hsjSO5/mOy30UlnI/ZV+ZiX2U6B3/bz/fWWE1EMq3xlcESj0dyot\n\tz7MJLmXoIpot2uI=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD,\n\tSPF_HELO_PASS autolearn=ham version=3.3.2 spammy=","X-HELO":"mx1.redhat.com","DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com ABADBC0467C4","Date":"Fri, 3 Nov 2017 15:31:12 +0100","From":"Marek Polacek <polacek@redhat.com>","To":"Martin =?utf-8?b?TGnFoWth?= <mliska@suse.cz>","Cc":"Nathan Sidwell <nathan@acm.org>, Jakub Jelinek <jakub@redhat.com>,\n\tJason Merrill <jason@redhat.com>,\n\tgcc-patches List <gcc-patches@gcc.gnu.org>","Subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","Message-ID":"<20171103143112.GM8422@redhat.com>","References":"<63fcd2b6-44d0-cb4b-d518-99eb496c1686@suse.cz>\n\t<20171027112600.GD14653@tucnak>\n\t<c28079ae-8d28-113a-8c02-7e60e86b52bb@suse.cz>\n\t<20171027135259.GG14653@tucnak>\n\t<CADzB+2kAqgX6dfhuNvcvAKatjQxRnvxTBQ2ZvD84WRubr_EFWA@mail.gmail.com>\n\t<20171027181831.GH14653@tucnak>\n\t<a0aaef40-f741-034d-10cb-45fedc4616f7@acm.org>\n\t<20171027183428.GI14653@tucnak>\n\t<3ee8c949-aa07-a998-a082-34fb2b4f5c73@acm.org>\n\t<f6376de4-a151-3f22-afa8-c357f73c3c11@suse.cz>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<f6376de4-a151-3f22-afa8-c357f73c3c11@suse.cz>","User-Agent":"Mutt/1.9.1 (2017-09-22)"}},{"id":1798684,"web_url":"http://patchwork.ozlabs.org/comment/1798684/","msgid":"<CADzB+2kqJpzDF0LhiTAVKauq9YLWRGetECm-rVfY=7URxHPHug@mail.gmail.com>","list_archive_url":null,"date":"2017-11-03T15:21:34","subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","submitter":{"id":4337,"url":"http://patchwork.ozlabs.org/api/people/4337/","name":"Jason Merrill","email":"jason@redhat.com"},"content":"On Fri, Nov 3, 2017 at 10:25 AM, Martin Liška <mliska@suse.cz> wrote:\n> On 10/27/2017 09:44 PM, Nathan Sidwell wrote:\n>> On 10/27/2017 02:34 PM, Jakub Jelinek wrote:\n>>\n>>> But when singly inheriting a polymorphic base and thus mapped to the same\n>>> vptr all but the last dtor will not be in charge, right?\n>>\n>> Correct.\n>>\n>>> So, if using build_clobber_this for this, instead of clobbering what we\n>>> clobber we'd just clear the single vptr (couldn't clobber the rest, even\n>>> if before the store, because that would make the earlier other vptr stores\n>>> dead).\n>>\n>> ok (I'd not looked at the patch to see if in chargeness was signficant)\n>>\n>> nathan\n>>\n>\n> Hello.\n>\n> I'm sending v2 which only zeros vptr of object.\n>\n> Ready to be installed after finishing tests?\n\nSurely we also want to check TYPE_CONTAINS_VPTR_P.\n\nJason","headers":{"Return-Path":"<gcc-patches-return-465861-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-465861-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"dfI6Mkw1\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yT5Kd0fnWz9s7M\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  4 Nov 2017 02:22:08 +1100 (AEDT)","(qmail 49294 invoked by alias); 3 Nov 2017 15:21:59 -0000","(qmail 49284 invoked by uid 89); 3 Nov 2017 15:21:58 -0000","from mail-io0-f195.google.com (HELO mail-io0-f195.google.com)\n\t(209.85.223.195) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 03 Nov 2017 15:21:57 +0000","by mail-io0-f195.google.com with SMTP id 97so6993251iok.7 for\n\t<gcc-patches@gcc.gnu.org>; Fri, 03 Nov 2017 08:21:57 -0700 (PDT)","by 10.107.170.26 with HTTP; Fri, 3 Nov 2017 08:21:34 -0700 (PDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-type:content-transfer-encoding; q=dns; s=\n\tdefault; b=o5BEVY0+1ckcXBoKsteu++7hp/bg5QEVosbg15Tcss/1DZEYFo5OD\n\tYzVdre4NvvjNuuL+v5C47KcQNxK3gHSahPuuzUWh8m8ffi4pAKpi++YxCghi5FSx\n\tJ9s6aHQpjDJmQa4PBBd+9xV1cJRB1jAkBQ5m5xuCcBEwGOajYrY4Zo=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-type:content-transfer-encoding; s=\n\tdefault; bh=EfZ7LCOG1Z7k+2xSBkHftLbtqFI=; b=dfI6Mkw1RKFcRF2u8vJH\n\tpm3AEMwB8Q935MXp2T/H6doKw9hJG6cAl3vih5rCPcVMihbwwExXwtD2hUGftliU\n\t5f2JctyqW+Cp6zuR30H3qIvWmUNDv+k4U2ZezHDY6kFR+BcBzafpVH2PSgBT0hz/\n\t0M1ZuF/uwQVvUla22d+bywI=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-2.4 required=5.0 tests=AWL, BAYES_00,\n\tRCVD_IN_DNSWL_NONE,\n\tRCVD_IN_SORBS_SPAM autolearn=no version=3.3.2\n\tspammy=Hx-languages-length:887, charge","X-HELO":"mail-io0-f195.google.com","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=ianaCyKWwPFhTEHgj6u8kUvNuazmBRCRSSXA+hGiPMc=;\n\tb=P2WiBc1t5olo8y5Zv8vXX8qS7VGUCZl5C44Pe2vhDqn81ZTIIhQIYGg88mShYOGGqs\n\tWQd5zBPWwrSj1gyn2xuGOuZxW9BLkSaLX0gGQ4cjKfRaJbK87k/y/XJrE22J4iS/Ma+z\n\tFh85L6wwnZWWamLv+TtTWV7zdfjWqWHpWLyJ+juM1X4qftpFlNuOdWG/3uHgmlyh1XpK\n\tMv2g8EqRB+SyiaNIDcVSStTO+AZV6Ngq8F/7lthgnl0lXhSOopuintrfxYOj/LyTm9lb\n\tTMsC8IUWdb8W6O/GZIbtMFIfaVn14X5XDD+8M2VykQ9Tkn07EA7c48MBWj/UXg3MvkXz\n\tICaA==","X-Gm-Message-State":"AJaThX4M2wgCP1dq/Jc8/dXTkWGK6QmXGWmWG18Or67Z4OOShnRi0mu0\tg2tRF+jn7zNrOw3fH+ZEN4VcMgzx6uS9gryVaNijwQ==","X-Google-Smtp-Source":"ABhQp+QYzPuUaMGYju+4DrBaqKc07LeEGmv+K1Ow1i6/S2+s+HzEQwBLmHkBEHXdVsTM/DeUmRfhkc4tIFjkuKRG4/Y=","X-Received":"by 10.107.63.67 with SMTP id m64mr9537418ioa.272.1509722515431;\n\tFri, 03 Nov 2017 08:21:55 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<f6376de4-a151-3f22-afa8-c357f73c3c11@suse.cz>","References":"<1d468e04-9f25-65f4-04a1-51b35abb3582@suse.cz>\n\t<20171027105212.GC14653@tucnak>\n\t<63fcd2b6-44d0-cb4b-d518-99eb496c1686@suse.cz>\n\t<20171027112600.GD14653@tucnak>\n\t<c28079ae-8d28-113a-8c02-7e60e86b52bb@suse.cz>\n\t<20171027135259.GG14653@tucnak>\n\t<CADzB+2kAqgX6dfhuNvcvAKatjQxRnvxTBQ2ZvD84WRubr_EFWA@mail.gmail.com>\n\t<20171027181831.GH14653@tucnak>\n\t<a0aaef40-f741-034d-10cb-45fedc4616f7@acm.org>\n\t<20171027183428.GI14653@tucnak>\n\t<3ee8c949-aa07-a998-a082-34fb2b4f5c73@acm.org>\n\t<f6376de4-a151-3f22-afa8-c357f73c3c11@suse.cz>","From":"Jason Merrill <jason@redhat.com>","Date":"Fri, 3 Nov 2017 11:21:34 -0400","Message-ID":"<CADzB+2kqJpzDF0LhiTAVKauq9YLWRGetECm-rVfY=7URxHPHug@mail.gmail.com>","Subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","To":"=?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz>","Cc":"Nathan Sidwell <nathan@acm.org>, Jakub Jelinek <jakub@redhat.com>,\n\tgcc-patches List <gcc-patches@gcc.gnu.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-IsSubscribed":"yes"}},{"id":1799353,"web_url":"http://patchwork.ozlabs.org/comment/1799353/","msgid":"<3e1e0928-d066-918c-cf13-2691fb45fd1e@suse.cz>","list_archive_url":null,"date":"2017-11-05T18:41:23","subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","submitter":{"id":62010,"url":"http://patchwork.ozlabs.org/api/people/62010/","name":"Martin Liška","email":"mliska@suse.cz"},"content":"On 11/03/2017 03:31 PM, Marek Polacek wrote:\n> I think the last dg-output shouldn't have any regexps at the end, so:\n> \n> // { dg-output \"0x\\[0-9a-fA-F]*: note: object has invalid vptr\" }\n\nThanks for that.\n\nI'll fix it.\n\nMartin","headers":{"Return-Path":"<gcc-patches-return-465978-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-465978-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"gEgWTNzk\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yVPfs4Cslz9s83\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon,  6 Nov 2017 05:41:39 +1100 (AEDT)","(qmail 4893 invoked by alias); 5 Nov 2017 18:41:30 -0000","(qmail 4878 invoked by uid 89); 5 Nov 2017 18:41:29 -0000","from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tSun, 05 Nov 2017 18:41:28 +0000","from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254])\tby\n\tmx2.suse.de (Postfix) with ESMTP id 357BDAAAD;\n\tSun,  5 Nov 2017 18:41:26 +0000 (UTC)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type:content-transfer-encoding; q=dns; s=\n\tdefault; b=jsb5zKNKM1bEeOsOeyZ4MczdhZVTa9hWPW8YRjywuj8ACiSYa/RDC\n\t1gkyk7L+WUVM4DbGYdG9bIxjU2Eu+kBkrgiY9IiAxAQjFnV2X/fgy3Fcoc+n9h+6\n\tNnNw6jrV9xKzdKn54GCFar+6x2Pj7UxabGecE/moRey3x9HZiPn9EQ=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type:content-transfer-encoding; s=default;\n\tbh=rW7IZ2nVbI1uUk/3RQWGvySuf3o=; b=gEgWTNzklXSE2GVdlZxnvNZRjvd1\n\ta2RMqIFYsjFHLeeZFroc33AGvMcpjNhyIwFHjH9tUFbL+z+Zj8t59Qsg9kmtZKbv\n\t0VOObwRd39xdGyMQvZZvD4WD5omZRTXKUWIEpdTJ1ChJBOSk2U72B/p6HeOOeDf1\n\tj/f0kE1SWCVZ8r8=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-1.9 required=5.0 tests=BAYES_00,\n\tSPF_PASS autolearn=ham version=3.3.2\n\tspammy=Hx-languages-length:279","X-HELO":"mx2.suse.de","Subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","To":"Marek Polacek <polacek@redhat.com>","Cc":"Nathan Sidwell <nathan@acm.org>, Jakub Jelinek <jakub@redhat.com>,\n\tJason Merrill <jason@redhat.com>,\n\tgcc-patches List <gcc-patches@gcc.gnu.org>","References":"<63fcd2b6-44d0-cb4b-d518-99eb496c1686@suse.cz>\n\t<20171027112600.GD14653@tucnak>\n\t<c28079ae-8d28-113a-8c02-7e60e86b52bb@suse.cz>\n\t<20171027135259.GG14653@tucnak>\n\t<CADzB+2kAqgX6dfhuNvcvAKatjQxRnvxTBQ2ZvD84WRubr_EFWA@mail.gmail.com>\n\t<20171027181831.GH14653@tucnak>\n\t<a0aaef40-f741-034d-10cb-45fedc4616f7@acm.org>\n\t<20171027183428.GI14653@tucnak>\n\t<3ee8c949-aa07-a998-a082-34fb2b4f5c73@acm.org>\n\t<f6376de4-a151-3f22-afa8-c357f73c3c11@suse.cz>\n\t<20171103143112.GM8422@redhat.com>","From":"=?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz>","Message-ID":"<3e1e0928-d066-918c-cf13-2691fb45fd1e@suse.cz>","Date":"Sun, 5 Nov 2017 19:41:23 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64;\n\trv:52.0) Gecko/20100101 Thunderbird/52.4.0","MIME-Version":"1.0","In-Reply-To":"<20171103143112.GM8422@redhat.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Transfer-Encoding":"7bit","X-IsSubscribed":"yes"}},{"id":1799499,"web_url":"http://patchwork.ozlabs.org/comment/1799499/","msgid":"<0081fab0-39d6-985c-e27a-680ca4208c25@suse.cz>","list_archive_url":null,"date":"2017-11-06T08:27:07","subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","submitter":{"id":62010,"url":"http://patchwork.ozlabs.org/api/people/62010/","name":"Martin Liška","email":"mliska@suse.cz"},"content":"On 11/03/2017 04:21 PM, Jason Merrill wrote:\n> On Fri, Nov 3, 2017 at 10:25 AM, Martin Liška <mliska@suse.cz> wrote:\n>> On 10/27/2017 09:44 PM, Nathan Sidwell wrote:\n>>> On 10/27/2017 02:34 PM, Jakub Jelinek wrote:\n>>>\n>>>> But when singly inheriting a polymorphic base and thus mapped to the same\n>>>> vptr all but the last dtor will not be in charge, right?\n>>>\n>>> Correct.\n>>>\n>>>> So, if using build_clobber_this for this, instead of clobbering what we\n>>>> clobber we'd just clear the single vptr (couldn't clobber the rest, even\n>>>> if before the store, because that would make the earlier other vptr stores\n>>>> dead).\n>>>\n>>> ok (I'd not looked at the patch to see if in chargeness was signficant)\n>>>\n>>> nathan\n>>>\n>>\n>> Hello.\n>>\n>> I'm sending v2 which only zeros vptr of object.\n>>\n>> Ready to be installed after finishing tests?\n> \n> Surely we also want to check TYPE_CONTAINS_VPTR_P.\n> \n> Jason\n> \n\nDone that in attached patch.\nPatch can bootstrap on ppc64le-redhat-linux and survives regression tests.\n\nReady to be installed?\nMartin\nFrom 882becbc5446f304a9445281c6f778b80086ce39 Mon Sep 17 00:00:00 2001\nFrom: marxin <mliska@suse.cz>\nDate: Thu, 19 Oct 2017 11:10:19 +0200\nSubject: [PATCH] Zero vptr in dtor for -fsanitize=vptr.\n\ngcc/cp/ChangeLog:\n\n2017-11-03  Martin Liska  <mliska@suse.cz>\n\n\t* decl.c (begin_destructor_body): In case of VPTR sanitization\n\t(with disabled recovery), zero vptr in order to catch virtual calls\n\tafter lifetime of an object.\n\ngcc/testsuite/ChangeLog:\n\n2017-10-27  Martin Liska  <mliska@suse.cz>\n\n\t* g++.dg/ubsan/vptr-12.C: New test.\n---\n gcc/cp/decl.c                        | 21 ++++++++++++++++++++-\n gcc/testsuite/g++.dg/ubsan/vptr-12.C | 22 ++++++++++++++++++++++\n 2 files changed, 42 insertions(+), 1 deletion(-)\n create mode 100644 gcc/testsuite/g++.dg/ubsan/vptr-12.C\n\ndiff --git a/gcc/cp/decl.c b/gcc/cp/decl.c\nindex 0ce8f2d3435..48d2760afde 100644\n--- a/gcc/cp/decl.c\n+++ b/gcc/cp/decl.c\n@@ -15247,7 +15247,26 @@ begin_destructor_body (void)\n       if (flag_lifetime_dse\n \t  /* Clobbering an empty base is harmful if it overlays real data.  */\n \t  && !is_empty_class (current_class_type))\n-\tfinish_decl_cleanup (NULL_TREE, build_clobber_this ());\n+      {\n+\tif (sanitize_flags_p (SANITIZE_VPTR)\n+\t    && (flag_sanitize_recover & SANITIZE_VPTR) == 0\n+\t    && TYPE_CONTAINS_VPTR_P (current_class_type))\n+\t  {\n+\t    tree binfo = TYPE_BINFO (current_class_type);\n+\t    tree ref\n+\t      = cp_build_indirect_ref (current_class_ptr, RO_NULL,\n+\t\t\t\t       tf_warning_or_error);\n+\n+\t    tree vtbl_ptr = build_vfield_ref (ref, TREE_TYPE (binfo));\n+\t    tree vtbl = build_zero_cst (TREE_TYPE (vtbl_ptr));\n+\t    tree stmt = cp_build_modify_expr (input_location, vtbl_ptr,\n+\t\t\t\t\t      NOP_EXPR, vtbl,\n+\t\t\t\t\t      tf_warning_or_error);\n+\t    finish_decl_cleanup (NULL_TREE, stmt);\n+\t  }\n+\telse\n+\t  finish_decl_cleanup (NULL_TREE, build_clobber_this ());\n+      }\n \n       /* And insert cleanups for our bases and members so that they\n \t will be properly destroyed if we throw.  */\ndiff --git a/gcc/testsuite/g++.dg/ubsan/vptr-12.C b/gcc/testsuite/g++.dg/ubsan/vptr-12.C\nnew file mode 100644\nindex 00000000000..f23bbc3fd10\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/ubsan/vptr-12.C\n@@ -0,0 +1,22 @@\n+// { dg-do run }\n+// { dg-shouldfail \"ubsan\" }\n+// { dg-options \"-fsanitize=vptr -fno-sanitize-recover=vptr\" }\n+\n+struct MyClass\n+{\n+  virtual ~MyClass () {}\n+  virtual void Doit () {}\n+};\n+\n+int\n+main ()\n+{\n+  MyClass *c = new MyClass;\n+  c->~MyClass ();\n+  c->Doit ();\n+\n+  return 0;\n+}\n+\n+// { dg-output \"\\[^\\n\\r]*vptr-12.C:16:\\[0-9]*: runtime error: member call on address 0x\\[0-9a-fA-F]* which does not point to an object of type 'MyClass'(\\n|\\r\\n|\\r)\" }\n+// { dg-output \"0x\\[0-9a-fA-F]*: note: object has invalid vptr\" }","headers":{"Return-Path":"<gcc-patches-return-465991-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-465991-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"A1metirL\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yVlzs1Bx3z9s7h\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon,  6 Nov 2017 19:27:36 +1100 (AEDT)","(qmail 36147 invoked by alias); 6 Nov 2017 08:27:29 -0000","(qmail 19677 invoked by uid 89); 6 Nov 2017 08:27:13 -0000","from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tMon, 06 Nov 2017 08:27:11 +0000","from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254])\tby\n\tmx2.suse.de (Postfix) with ESMTP id 1242AAAC8;\n\tMon,  6 Nov 2017 08:27:08 +0000 (UTC)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type; q=dns; s=default; b=CXe/FhY1htD97c+mY\n\tRmSigR4382iZRGUjSu0CEWFKSADjj/x+fioP2OL8qIOKHd26H7J54wVrDPcCyS8q\n\tQy+gZzVFGe7hCnmT4t5H6BaaYauBI08nEZcuegNThKliQUPnSFREvWBRzOYxn/Id\n\t0VkFqXAjpvd6Ab07Fa4pBbDzqo=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type; s=default; bh=xRGmKqxFhNdV7GzGnOVfdIV\n\ton4o=; b=A1metirLJ3vEy3pPuwB0hlj4elwvZh2pttYSZpR341sa8LYEbtxuT3d\n\t91wCqkpEDp51DCKYHHFDTzDuKz2ZO03wz8+w2KtUT4atLXvIBhSEWW3heNvyzseJ\n\tivH0khWVhtaHOyQGgZe+68hqxiiMN52dhGUrq3thRW9GO42XBYDc=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=recovery,\n\tfinishing, Nathan, 2001","X-HELO":"mx2.suse.de","Subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","To":"Jason Merrill <jason@redhat.com>","Cc":"Nathan Sidwell <nathan@acm.org>, Jakub Jelinek <jakub@redhat.com>,\n\tgcc-patches List <gcc-patches@gcc.gnu.org>","References":"<1d468e04-9f25-65f4-04a1-51b35abb3582@suse.cz>\n\t<20171027105212.GC14653@tucnak>\n\t<63fcd2b6-44d0-cb4b-d518-99eb496c1686@suse.cz>\n\t<20171027112600.GD14653@tucnak>\n\t<c28079ae-8d28-113a-8c02-7e60e86b52bb@suse.cz>\n\t<20171027135259.GG14653@tucnak>\n\t<CADzB+2kAqgX6dfhuNvcvAKatjQxRnvxTBQ2ZvD84WRubr_EFWA@mail.gmail.com>\n\t<20171027181831.GH14653@tucnak>\n\t<a0aaef40-f741-034d-10cb-45fedc4616f7@acm.org>\n\t<20171027183428.GI14653@tucnak>\n\t<3ee8c949-aa07-a998-a082-34fb2b4f5c73@acm.org>\n\t<f6376de4-a151-3f22-afa8-c357f73c3c11@suse.cz>\n\t<CADzB+2kqJpzDF0LhiTAVKauq9YLWRGetECm-rVfY=7URxHPHug@mail.gmail.com>","From":"=?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz>","Message-ID":"<0081fab0-39d6-985c-e27a-680ca4208c25@suse.cz>","Date":"Mon, 6 Nov 2017 09:27:07 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64;\n\trv:52.0) Gecko/20100101 Thunderbird/52.4.0","MIME-Version":"1.0","In-Reply-To":"<CADzB+2kqJpzDF0LhiTAVKauq9YLWRGetECm-rVfY=7URxHPHug@mail.gmail.com>","Content-Type":"multipart/mixed;\n\tboundary=\"------------0BC08D87EFB5921C5C95225F\"","X-IsSubscribed":"yes"}},{"id":1804485,"web_url":"http://patchwork.ozlabs.org/comment/1804485/","msgid":"<2d0b8bf2-b2d5-5d63-96f6-038adc01b2ac@suse.cz>","list_archive_url":null,"date":"2017-11-14T16:08:39","subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","submitter":{"id":62010,"url":"http://patchwork.ozlabs.org/api/people/62010/","name":"Martin Liška","email":"mliska@suse.cz"},"content":"PING^1\n\nOn 11/06/2017 09:27 AM, Martin Liška wrote:\n> On 11/03/2017 04:21 PM, Jason Merrill wrote:\n>> On Fri, Nov 3, 2017 at 10:25 AM, Martin Liška <mliska@suse.cz> wrote:\n>>> On 10/27/2017 09:44 PM, Nathan Sidwell wrote:\n>>>> On 10/27/2017 02:34 PM, Jakub Jelinek wrote:\n>>>>\n>>>>> But when singly inheriting a polymorphic base and thus mapped to the same\n>>>>> vptr all but the last dtor will not be in charge, right?\n>>>>\n>>>> Correct.\n>>>>\n>>>>> So, if using build_clobber_this for this, instead of clobbering what we\n>>>>> clobber we'd just clear the single vptr (couldn't clobber the rest, even\n>>>>> if before the store, because that would make the earlier other vptr stores\n>>>>> dead).\n>>>>\n>>>> ok (I'd not looked at the patch to see if in chargeness was signficant)\n>>>>\n>>>> nathan\n>>>>\n>>>\n>>> Hello.\n>>>\n>>> I'm sending v2 which only zeros vptr of object.\n>>>\n>>> Ready to be installed after finishing tests?\n>>\n>> Surely we also want to check TYPE_CONTAINS_VPTR_P.\n>>\n>> Jason\n>>\n> \n> Done that in attached patch.\n> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.\n> \n> Ready to be installed?\n> Martin\n>","headers":{"Return-Path":"<gcc-patches-return-466750-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-466750-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"HMsfDUL2\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3ybsrM62Glz9sDB\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 15 Nov 2017 03:08:51 +1100 (AEDT)","(qmail 62049 invoked by alias); 14 Nov 2017 16:08:43 -0000","(qmail 62015 invoked by uid 89); 14 Nov 2017 16:08:42 -0000","from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tTue, 14 Nov 2017 16:08:41 +0000","from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254])\tby\n\tmx2.suse.de (Postfix) with ESMTP id E695781314;\n\tTue, 14 Nov 2017 16:08:39 +0000 (UTC)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:from:to:cc:references:message-id:date:mime-version\n\t:in-reply-to:content-type:content-transfer-encoding; q=dns; s=\n\tdefault; b=FyqiBJn3KeKf9HUhAkIGQKFEWeOgsap4Hjum+OkSSa5CGa7fBKZV1\n\tun2aHGMTwtzvgzSAJdtHACNe/hiq3yyTgAB3ebR4s70jFtAzAfltaGgj+ECjoWra\n\tg1yNBZOdX9wDY1msdPyHMw8/RxIKV7YYg8bW3vXcBP3cHzG7UGGLsI=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:from:to:cc:references:message-id:date:mime-version\n\t:in-reply-to:content-type:content-transfer-encoding; s=default;\n\tbh=suyNKlr4vGE8RdfN5rgxXrg6XUo=; b=HMsfDUL2jY2IvzhGccH2s/DiVPhO\n\tEOKgtC6MySd2ZQOAoNESc93B4bJt2yNsqMQ/7cvmSjRu/P8hRMKLfDMyiiPCAx/i\n\tP5awfmaQgJ++8d+IpUphUH7j+7y6vZwFlU02rPOWWR/GzJomUBxrZyh6goVFrIXH\n\taabKUZr24E7aXvI=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-1.7 required=5.0 tests=BAYES_00,\n\tKB_WAM_FROM_NAME_SINGLEWORD,\n\tSPF_PASS autolearn=no version=3.3.2 spammy=charge,\n\tHContent-Transfer-Encoding:8bit","X-HELO":"mx2.suse.de","Subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","From":"=?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz>","To":"Jason Merrill <jason@redhat.com>","Cc":"Nathan Sidwell <nathan@acm.org>, Jakub Jelinek <jakub@redhat.com>,\n\tgcc-patches List <gcc-patches@gcc.gnu.org>","References":"<1d468e04-9f25-65f4-04a1-51b35abb3582@suse.cz>\n\t<20171027105212.GC14653@tucnak>\n\t<63fcd2b6-44d0-cb4b-d518-99eb496c1686@suse.cz>\n\t<20171027112600.GD14653@tucnak>\n\t<c28079ae-8d28-113a-8c02-7e60e86b52bb@suse.cz>\n\t<20171027135259.GG14653@tucnak>\n\t<CADzB+2kAqgX6dfhuNvcvAKatjQxRnvxTBQ2ZvD84WRubr_EFWA@mail.gmail.com>\n\t<20171027181831.GH14653@tucnak>\n\t<a0aaef40-f741-034d-10cb-45fedc4616f7@acm.org>\n\t<20171027183428.GI14653@tucnak>\n\t<3ee8c949-aa07-a998-a082-34fb2b4f5c73@acm.org>\n\t<f6376de4-a151-3f22-afa8-c357f73c3c11@suse.cz>\n\t<CADzB+2kqJpzDF0LhiTAVKauq9YLWRGetECm-rVfY=7URxHPHug@mail.gmail.com>\n\t<0081fab0-39d6-985c-e27a-680ca4208c25@suse.cz>","Message-ID":"<2d0b8bf2-b2d5-5d63-96f6-038adc01b2ac@suse.cz>","Date":"Tue, 14 Nov 2017 17:08:39 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64;\n\trv:52.0) Gecko/20100101 Thunderbird/52.4.0","MIME-Version":"1.0","In-Reply-To":"<0081fab0-39d6-985c-e27a-680ca4208c25@suse.cz>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Transfer-Encoding":"8bit","X-IsSubscribed":"yes"}},{"id":1804495,"web_url":"http://patchwork.ozlabs.org/comment/1804495/","msgid":"<CADzB+2=f_jGNOTKYhO1XuP5ctcAbMNPa2tw4v2iVQmmXnYTybA@mail.gmail.com>","list_archive_url":null,"date":"2017-11-14T16:26:06","subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","submitter":{"id":4337,"url":"http://patchwork.ozlabs.org/api/people/4337/","name":"Jason Merrill","email":"jason@redhat.com"},"content":"OK.\n\nOn Mon, Nov 6, 2017 at 3:27 AM, Martin Liška <mliska@suse.cz> wrote:\n> On 11/03/2017 04:21 PM, Jason Merrill wrote:\n>> On Fri, Nov 3, 2017 at 10:25 AM, Martin Liška <mliska@suse.cz> wrote:\n>>> On 10/27/2017 09:44 PM, Nathan Sidwell wrote:\n>>>> On 10/27/2017 02:34 PM, Jakub Jelinek wrote:\n>>>>\n>>>>> But when singly inheriting a polymorphic base and thus mapped to the same\n>>>>> vptr all but the last dtor will not be in charge, right?\n>>>>\n>>>> Correct.\n>>>>\n>>>>> So, if using build_clobber_this for this, instead of clobbering what we\n>>>>> clobber we'd just clear the single vptr (couldn't clobber the rest, even\n>>>>> if before the store, because that would make the earlier other vptr stores\n>>>>> dead).\n>>>>\n>>>> ok (I'd not looked at the patch to see if in chargeness was signficant)\n>>>>\n>>>> nathan\n>>>>\n>>>\n>>> Hello.\n>>>\n>>> I'm sending v2 which only zeros vptr of object.\n>>>\n>>> Ready to be installed after finishing tests?\n>>\n>> Surely we also want to check TYPE_CONTAINS_VPTR_P.\n>>\n>> Jason\n>>\n>\n> Done that in attached patch.\n> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.\n>\n> Ready to be installed?\n> Martin","headers":{"Return-Path":"<gcc-patches-return-466752-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-466752-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"Mb01TaAq\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3ybtDv71Jsz9sDB\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 15 Nov 2017 03:26:39 +1100 (AEDT)","(qmail 79494 invoked by alias); 14 Nov 2017 16:26:30 -0000","(qmail 79484 invoked by uid 89); 14 Nov 2017 16:26:30 -0000","from mail-it0-f66.google.com (HELO mail-it0-f66.google.com)\n\t(209.85.214.66) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tTue, 14 Nov 2017 16:26:29 +0000","by mail-it0-f66.google.com with SMTP id n134so5690532itg.3 for\n\t<gcc-patches@gcc.gnu.org>; Tue, 14 Nov 2017 08:26:29 -0800 (PST)","by 10.107.171.196 with HTTP; Tue, 14 Nov 2017 08:26:06 -0800 (PST)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-type:content-transfer-encoding; q=dns; s=\n\tdefault; b=T4/uNO3ROVvsUUSJV+1Igeg3/RzuJrdeSpEKFoha2N0mAP9L6r9Jd\n\tXUW01pJZxbXi6km25QK0EF/rNczi0VuHKc4UgHi4DMcqB+hyctPrG2Vcq8YqO/Na\n\tvRyQ2AK35nRfrTki4Uv1EVVA1RtV52eaXCYtaB99/sMPm9AAeplhKk=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-type:content-transfer-encoding; s=\n\tdefault; bh=yCWSbYADc2pcWU26Bq5lqfyrWDM=; b=Mb01TaAq2Ik8qo3TjsrO\n\t4IHtLcWDvoisBo9UctoO4J6HrLswrn8KlSTvS2h29GAF0SsxMQk4C947SeRi9rO5\n\td135KoRp1NhiPtwKZcBe3r+xFac62dd7snu8wp/JnkdYnrV2AUmjMZNYvNMK8JDg\n\tjQYcJbf2NVyD6zWhU3agGPE=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-1.6 required=5.0 tests=AWL, BAYES_00,\n\tKAM_LAZY_DOMAIN_SECURITY, KB_WAM_FROM_NAME_SINGLEWORD,\n\tRCVD_IN_DNSWL_NONE autolearn=no version=3.3.2\n\tspammy=Hx-languages-length:1217, charge","X-HELO":"mail-it0-f66.google.com","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=AHQvhNRrwG+bFzpcnFrXXY1tkDHiJivXP04yn1laAb8=;\n\tb=BsxLhiEsKQL+M6k32D6f+vM7uQd7QpAnQagYFjbROPY0eioELwubgpclbLv5t+T5P9\n\tjP+jq3Cb+C2L4q6n37/KyaHx7I5Dnm9vRx/+ehPoazO+97fQU3mf2tcH6vj9GUzgP8tl\n\tUIe/pj9BYbEYk2XF6UaCFwXLoQFhAEMPpPa4wEoNtO1eldch+/gCtkLMGRSbh5Ten0bU\n\t5VFZoys8CNPnBimqtPX+3lfGHtbb4sczY2M4onLvBpC5HKSpbCc3Kj4OAI/k4uSyULyX\n\t8656G79wOxHbr6kpKh6TjsJOPm8IArllT0m3dxF4fbJ5plDq3GEVOENDVxbhNMjdwvcD\n\tVbEQ==","X-Gm-Message-State":"AJaThX68FA0RXECf9gO37Rc1Me9bwhb66NciS4HdYt4LflXmht50XkdA\txo4AcIQMVE7MxeZZFJzFabmrXnL6sP5vWVetRH+9GA==","X-Google-Smtp-Source":"AGs4zMb5ff0n4nGQMLD14+aiXgP5B1gno+tIy5cYdA+8UORG3xzBV3ZXSNzT4vmHUWgt2lVSAXCM7lkXgUPRG9upFJc=","X-Received":"by 10.36.147.198 with SMTP id y189mr15795630itd.6.1510676787685;\n\tTue, 14 Nov 2017 08:26:27 -0800 (PST)","MIME-Version":"1.0","In-Reply-To":"<0081fab0-39d6-985c-e27a-680ca4208c25@suse.cz>","References":"<1d468e04-9f25-65f4-04a1-51b35abb3582@suse.cz>\n\t<20171027105212.GC14653@tucnak>\n\t<63fcd2b6-44d0-cb4b-d518-99eb496c1686@suse.cz>\n\t<20171027112600.GD14653@tucnak>\n\t<c28079ae-8d28-113a-8c02-7e60e86b52bb@suse.cz>\n\t<20171027135259.GG14653@tucnak>\n\t<CADzB+2kAqgX6dfhuNvcvAKatjQxRnvxTBQ2ZvD84WRubr_EFWA@mail.gmail.com>\n\t<20171027181831.GH14653@tucnak>\n\t<a0aaef40-f741-034d-10cb-45fedc4616f7@acm.org>\n\t<20171027183428.GI14653@tucnak>\n\t<3ee8c949-aa07-a998-a082-34fb2b4f5c73@acm.org>\n\t<f6376de4-a151-3f22-afa8-c357f73c3c11@suse.cz>\n\t<CADzB+2kqJpzDF0LhiTAVKauq9YLWRGetECm-rVfY=7URxHPHug@mail.gmail.com>\n\t<0081fab0-39d6-985c-e27a-680ca4208c25@suse.cz>","From":"Jason Merrill <jason@redhat.com>","Date":"Tue, 14 Nov 2017 11:26:06 -0500","Message-ID":"<CADzB+2=f_jGNOTKYhO1XuP5ctcAbMNPa2tw4v2iVQmmXnYTybA@mail.gmail.com>","Subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","To":"=?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz>","Cc":"Nathan Sidwell <nathan@acm.org>, Jakub Jelinek <jakub@redhat.com>,\n\tgcc-patches List <gcc-patches@gcc.gnu.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-IsSubscribed":"yes"}},{"id":1804853,"web_url":"http://patchwork.ozlabs.org/comment/1804853/","msgid":"<fb936a0e-5aed-7a68-89dd-5a1d2a1ce363@suse.cz>","list_archive_url":null,"date":"2017-11-15T09:04:40","subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","submitter":{"id":62010,"url":"http://patchwork.ozlabs.org/api/people/62010/","name":"Martin Liška","email":"mliska@suse.cz"},"content":"Thanks for review. I actually noticed your introduction of\ncp_build_fold_indirect_ref after I installed my patch.\n\nI'm testing following fix.\n\nMartin\nFrom 63d9cff5c183f3614cff527ff991e1586a9efa5b Mon Sep 17 00:00:00 2001\nFrom: marxin <mliska@suse.cz>\nDate: Wed, 15 Nov 2017 10:01:51 +0100\nSubject: [PATCH] Fix fallout of -fsanitize=vptr.\n\ngcc/cp/ChangeLog:\n\n2017-11-15  Martin Liska  <mliska@suse.cz>\n\n\t* decl.c (begin_destructor_body): Use cp_build_fold_indirect_ref\n\tinstead of cp_build_indirect_ref.\n---\n gcc/cp/decl.c | 3 +--\n 1 file changed, 1 insertion(+), 2 deletions(-)\n\ndiff --git a/gcc/cp/decl.c b/gcc/cp/decl.c\nindex 041893db937..7e16f7b415b 100644\n--- a/gcc/cp/decl.c\n+++ b/gcc/cp/decl.c\n@@ -15253,8 +15253,7 @@ begin_destructor_body (void)\n \t  {\n \t    tree binfo = TYPE_BINFO (current_class_type);\n \t    tree ref\n-\t      = cp_build_indirect_ref (current_class_ptr, RO_NULL,\n-\t\t\t\t       tf_warning_or_error);\n+\t      = cp_build_fold_indirect_ref (current_class_ptr);\n \n \t    tree vtbl_ptr = build_vfield_ref (ref, TREE_TYPE (binfo));\n \t    tree vtbl = build_zero_cst (TREE_TYPE (vtbl_ptr));","headers":{"Return-Path":"<gcc-patches-return-466828-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-466828-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"hXTZasFO\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3ycJQ76FDbz9sP1\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 15 Nov 2017 20:06:06 +1100 (AEDT)","(qmail 113932 invoked by alias); 15 Nov 2017 09:05:45 -0000","(qmail 84315 invoked by uid 89); 15 Nov 2017 09:04:45 -0000","from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tWed, 15 Nov 2017 09:04:44 +0000","from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254])\tby\n\tmx2.suse.de (Postfix) with ESMTP id D99D9AC77;\n\tWed, 15 Nov 2017 09:04:40 +0000 (UTC)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type; q=dns; s=default; b=XPSO2tfJJtSNVvOwG\n\tGtcdz+5D6+hCeSUo7ldCgQ1Yb4J1ljmi/7fYQmqxpnTFWXrrXCz3nORAJkOGlPVc\n\tiIKVMfRmAPKmPciZobbeH0a8r9mWNMfhedrGrUjLxqPDGxJJE2+P+TLkJQSZRWq6\n\t6EBQaTmYi3NwRkXHJjZNfGV+Hw=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type; s=default; bh=x/AKq0Ir/xrwrLUXLNbhrK+\n\tiv58=; b=hXTZasFO0WzPh8QVgSX8qmDusqrhuSKSsHva950iTWeiqtokkkDYGgA\n\txrBq8dk8oGzm9yXoLn6f6mrmNlwF9kR8/dvyik4goYGfT7Oc1GGFNqpXLIAFNY4t\n\txvQ14I5TwO1yFaQTs0iaBi4CgWEstptjnFHVw9FrbL9MmCStNOqE=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-26.7 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3,\n\tKB_WAM_FROM_NAME_SINGLEWORD,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=sk:begin_d","X-HELO":"mx2.suse.de","Subject":"Re: [PATCH] Zero vptr in dtor for -fsanitize=vptr.","To":"Jason Merrill <jason@redhat.com>","Cc":"Nathan Sidwell <nathan@acm.org>, Jakub Jelinek <jakub@redhat.com>,\n\tgcc-patches List <gcc-patches@gcc.gnu.org>","References":"<1d468e04-9f25-65f4-04a1-51b35abb3582@suse.cz>\n\t<20171027105212.GC14653@tucnak>\n\t<63fcd2b6-44d0-cb4b-d518-99eb496c1686@suse.cz>\n\t<20171027112600.GD14653@tucnak>\n\t<c28079ae-8d28-113a-8c02-7e60e86b52bb@suse.cz>\n\t<20171027135259.GG14653@tucnak>\n\t<CADzB+2kAqgX6dfhuNvcvAKatjQxRnvxTBQ2ZvD84WRubr_EFWA@mail.gmail.com>\n\t<20171027181831.GH14653@tucnak>\n\t<a0aaef40-f741-034d-10cb-45fedc4616f7@acm.org>\n\t<20171027183428.GI14653@tucnak>\n\t<3ee8c949-aa07-a998-a082-34fb2b4f5c73@acm.org>\n\t<f6376de4-a151-3f22-afa8-c357f73c3c11@suse.cz>\n\t<CADzB+2kqJpzDF0LhiTAVKauq9YLWRGetECm-rVfY=7URxHPHug@mail.gmail.com>\n\t<0081fab0-39d6-985c-e27a-680ca4208c25@suse.cz>\n\t<CADzB+2=f_jGNOTKYhO1XuP5ctcAbMNPa2tw4v2iVQmmXnYTybA@mail.gmail.com>","From":"=?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz>","Message-ID":"<fb936a0e-5aed-7a68-89dd-5a1d2a1ce363@suse.cz>","Date":"Wed, 15 Nov 2017 10:04:40 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64;\n\trv:52.0) Gecko/20100101 Thunderbird/52.4.0","MIME-Version":"1.0","In-Reply-To":"<CADzB+2=f_jGNOTKYhO1XuP5ctcAbMNPa2tw4v2iVQmmXnYTybA@mail.gmail.com>","Content-Type":"multipart/mixed;\n\tboundary=\"------------3B271E5372CBE34546307D6B\"","X-IsSubscribed":"yes"}}]