From patchwork Sun Sep 21 02:42:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 391635 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 63B5314009C for ; Sun, 21 Sep 2014 12:42:30 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; q=dns; s=default; b=NTyurMxHLD73FYTx1 IqZzdx0CraiAcmLEcV6R/uBDJOJJUFkA1evc24DB1uuPDWNt/LvQFfslZ8XFuZq4 RXilmAkga0tw8inMkVKon++NBzCuOzpwskWA2a1YxSVokqW3lOmZDyvihwdYNyfd uPXQA9zvu/fKdkYdVcgGMgRIt8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; s=default; bh=aH+EwlnlbjfLld1hBeU3w/P jtFo=; b=PdMhIF++slAjT6YAVnoqiSlQ1wToRn+Jp3maxhiTjwB21aI51c5S7w7 Z0vsvQQurtNitItgx9e1CRfWU2LdpCVdhchLG8zzkIP8nPMzYwk5KeJ/Q+CaC8b1 B43KmXVExuOAedXOJZoPOh3sEgHnQ9K7kl1dh2ExhLYHUfDJeWd4= Received: (qmail 28424 invoked by alias); 21 Sep 2014 02:42:20 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 28345 invoked by uid 89); 21 Sep 2014 02:42:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sun, 21 Sep 2014 02:42:07 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8L2g6n1010368 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Sat, 20 Sep 2014 22:42:06 -0400 Received: from [10.10.116.16] ([10.10.116.16]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8L2g56H013870; Sat, 20 Sep 2014 22:42:05 -0400 Message-ID: <541E3AF9.3010907@redhat.com> Date: Sat, 20 Sep 2014 22:42:01 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 MIME-Version: 1.0 To: Jakub Jelinek , gcc-patches@gcc.gnu.org Subject: Re: [committed] Don't instrument clobbers with asan (PR c++/62017) References: <20140918141246.GJ17454@tucnak.redhat.com> In-Reply-To: <20140918141246.GJ17454@tucnak.redhat.com> On 09/18/2014 10:12 AM, Jakub Jelinek wrote: > Clobber stmts, being artificial statements, were certainly never > meant to be instrumented. In 4.8 when asan has been introduced into gcc, > the lhs of clobber could be only a decl and as a whole decl store would not > be really instrumented, but with *this clobbers in 4.9 that is no longer the > case. And this patch fixes the clobber to only clobber the as-base part of the class, since any virtual bases might not be destroyed yet. This patch also fixes Jakub's testcase (without his patch). Tested x86_64-pc-linux-gnu, applying to trunk. commit e8c36b9fe6c1534925d809a7a15e599770466ee3 Author: Jason Merrill Date: Thu Sep 18 11:15:57 2014 -0400 PR c++/62017 * decl.c (begin_destructor_body): Only clobber the as-base part of *this. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 59dada7..fe5a4af 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -13808,10 +13808,12 @@ begin_destructor_body (void) /* Insert a cleanup to let the back end know that the object is dead when we exit the destructor, either normally or via exception. */ - tree clobber = build_constructor (current_class_type, NULL); + tree btype = CLASSTYPE_AS_BASE (current_class_type); + tree clobber = build_constructor (btype, NULL); TREE_THIS_VOLATILE (clobber) = true; - tree exprstmt = build2 (MODIFY_EXPR, current_class_type, - current_class_ref, clobber); + tree bref = build_nop (build_reference_type (btype), current_class_ptr); + bref = convert_from_reference (bref); + tree exprstmt = build2 (MODIFY_EXPR, btype, bref, clobber); finish_decl_cleanup (NULL_TREE, exprstmt); /* And insert cleanups for our bases and members so that they