From patchwork Tue Nov 27 18:46:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 202281 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]) by ozlabs.org (Postfix) with SMTP id 7AD4F2C008C for ; Wed, 28 Nov 2012 05:46:48 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1354646808; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=i8i1gnee950Y+sD2njh/ 5SfnTXM=; b=f9RCCshAprLMOLzI1LgoAy/XEF3B+Rbtvftg38qUQuAIcD3HG30r SiBC0E7fiLXbCNoJSqRCbo5z58jfzp7yrpeD2/wY2b/GX2Icw0qrkwgo3uEwNXOz V4WYDbF/1ku937lv2USffiM2Mz1NcCpQ+S0ajVD0enI4hUSliHjwj/E= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=v+hgUh5hbHybacSny3fKmhsNSLSLYiUs+NBGnDvpGacT4F4yyeMQT/RgEJHibL B/iarA0VSIyQdloIUJA91qe1epoLeDIpdbhcsYyNmAAUX4m/XwsTTHfm0UDAjWfi ZBno5qr3ZQEz8TjrzwVS7IZBiPASU93oZZ4BadhTsQdr4=; Received: (qmail 20404 invoked by alias); 27 Nov 2012 18:46:42 -0000 Received: (qmail 20299 invoked by uid 22791); 27 Nov 2012 18:46:40 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS, TW_TM X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 27 Nov 2012 18:46:34 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qARIkXYR017136 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 27 Nov 2012 13:46:34 -0500 Received: from zalov.redhat.com (vpn1-7-172.ams2.redhat.com [10.36.7.172]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qARIkWOM002238 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 27 Nov 2012 13:46:33 -0500 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.redhat.com (8.14.5/8.14.5) with ESMTP id qARIkVQ0029322; Tue, 27 Nov 2012 19:46:31 +0100 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id qARIkVtg029321; Tue, 27 Nov 2012 19:46:31 +0100 Date: Tue, 27 Nov 2012 19:46:30 +0100 From: Jakub Jelinek To: Dodji Seketeli Cc: gcc-patches@gcc.gnu.org Subject: [asan] Another ICE fix Message-ID: <20121127184630.GF2315@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 Hi! E.g. on c_char_tests.f03 we have a stmt like _2 = VIEW_CONVERT_EXPR(121)[1]{lb: 1 sz: 1}; after inlining (wonder why we never fold that to 121), which asan incorrectly considered to be a load and thus attempted to instrument it, by taking address of the rhs. Fixed thusly, ok for trunk? 2012-11-27 Jakub Jelinek * asan.c (instrument_assignment): Instrument lhs only for gimple_store_p and rhs1 only for gimple_assign_load_p. Jakub --- gcc/asan.c.jj 2012-11-27 17:37:10.000000000 +0100 +++ gcc/asan.c 2012-11-27 18:37:21.316247456 +0100 @@ -1358,10 +1358,12 @@ instrument_assignment (gimple_stmt_itera gcc_assert (gimple_assign_single_p (s)); - instrument_derefs (iter, gimple_assign_lhs (s), - gimple_location (s), true); - instrument_derefs (iter, gimple_assign_rhs1 (s), - gimple_location (s), false); + if (gimple_store_p (s)) + instrument_derefs (iter, gimple_assign_lhs (s), + gimple_location (s), true); + if (gimple_assign_load_p (s)) + instrument_derefs (iter, gimple_assign_rhs1 (s), + gimple_location (s), false); } /* Instrument the function call pointed to by the iterator ITER, if it