From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 37643 invoked by alias); 12 Feb 2019 11:46:03 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 37629 invoked by uid 89); 12 Feb 2019 11:46:03 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= 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 ESMTP; Tue, 12 Feb 2019 11:46:01 +0000 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 852357F3E9; Tue, 12 Feb 2019 11:46:00 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-88.ams2.redhat.com [10.36.116.88]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 29AB3101E842; Tue, 12 Feb 2019 11:46:00 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id x1CBjvYo000601; Tue, 12 Feb 2019 12:45:58 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id x1CBju1V000600; Tue, 12 Feb 2019 12:45:56 +0100 Date: Tue, 12 Feb 2019 11:46:00 -0000 From: Jakub Jelinek To: Eric Botcazou Cc: gcc-patches@gcc.gnu.org Subject: Re: [patch] Disable store merging in asan_expand_mark_ifn Message-ID: <20190212114556.GM2135@tucnak> Reply-To: Jakub Jelinek References: <4495488.sKnqla6Psi@polaris> <7245552.sqmLjyS5Qn@polaris> <20190211125911.GE2135@tucnak> <31635045.AcoORThygm@polaris> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <31635045.AcoORThygm@polaris> User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes X-SW-Source: 2019-02/txt/msg00878.txt.bz2 On Tue, Feb 12, 2019 at 12:41:47PM +0100, Eric Botcazou wrote: > > Ok, stand corrected on that, 128-bit indeed, but even that is nothing not > > really used. > > The irony is that I'm doing this for 32-bit SPARC (we cannot get ASAN to work > in 64-bit mode for the time being) and the maximum alignment on 32-bit SPARC > is 64-bit (even long doubles) so this will be totally unused. ;-) > > > For STRICT_ALIGNMENT targets store merging pass obviously can't do anything > > with those, because unlike asan.c it can't figure out the alignment. > > OK, revised patch attached. I have manually verified that it yields the > expected result for an array of long doubles on 64-bit SPARC. > > > 2019-02-12 Eric Botcazou > > * asan.c (asan_expand_mark_ifn): Take into account the alignment of > the object to pick the size of stores on strict-alignment platforms. Ok, thanks. > Index: asan.c > =================================================================== > --- asan.c (revision 268508) > +++ asan.c (working copy) > @@ -3218,7 +3218,10 @@ asan_expand_mark_ifn (gimple_stmt_iterat > /* Generate direct emission if size_in_bytes is small. */ > if (size_in_bytes <= ASAN_PARAM_USE_AFTER_SCOPE_DIRECT_EMISSION_THRESHOLD) > { > - unsigned HOST_WIDE_INT shadow_size = shadow_mem_size (size_in_bytes); > + const unsigned HOST_WIDE_INT shadow_size > + = shadow_mem_size (size_in_bytes); > + const unsigned int shadow_align > + = (get_pointer_alignment (base) / BITS_PER_UNIT) >> ASAN_SHADOW_SHIFT; > > tree shadow = build_shadow_mem_access (iter, loc, base_addr, > shadow_ptr_types[0], true); > @@ -3226,9 +3229,11 @@ asan_expand_mark_ifn (gimple_stmt_iterat > for (unsigned HOST_WIDE_INT offset = 0; offset < shadow_size;) > { > unsigned size = 1; > - if (shadow_size - offset >= 4) > + if (shadow_size - offset >= 4 > + && (!STRICT_ALIGNMENT || shadow_align >= 4)) > size = 4; > - else if (shadow_size - offset >= 2) > + else if (shadow_size - offset >= 2 > + && (!STRICT_ALIGNMENT || shadow_align >= 2)) > size = 2; > > unsigned HOST_WIDE_INT last_chunk_size = 0; Jakub