From patchwork Sat Nov 10 13:17:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 198185 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 A997C2C0081 for ; Sun, 11 Nov 2012 00:17:38 +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=1353158260; h=Comment: DomainKey-Signature:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=9ivcbL2zxPfdYCYmaCKicpwP0BA=; b=yHR22QO902Wzgtf DLQ6cWlRx/gE48V7SefTNK9eV1pvN2G0y0wxlo+LZnepdaOgjB28jTW6IV1TY4VN Ef10eRmRmkYyFfFvPa7Eu6i5xsOwjgh98+OkLKlZcpvtTc99GrSukXFNNtsn/ftx yDNEdSd8f4QqgJMzgE5VfMdHhREA= 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:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=ZgKK1CCWnWshGKzmX5c6h99DPfPD3b3a/Xe/rhUjzIT0fuN/pKTVrHR44Gb71m l53ocotIGAGlnxh7bE0pzvYRAK1YgvlEx8lZYhty/r8Jn2sM0VDT6Jo8n744sUKy pYqAO42XluXEVyMg9h+0Ri358in8XRsq3SbzQDrGOQb58=; Received: (qmail 8082 invoked by alias); 10 Nov 2012 13:17:34 -0000 Received: (qmail 8074 invoked by uid 22791); 10 Nov 2012 13:17:33 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED, RCVD_IN_DNSWL_NONE, TW_TM X-Spam-Check-By: sourceware.org Received: from mx01.qsc.de (HELO mx01.qsc.de) (213.148.129.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 10 Nov 2012 13:17:26 +0000 Received: from [192.168.178.25] (port-92-195-110-241.dynamic.qsc.de [92.195.110.241]) by mx01.qsc.de (Postfix) with ESMTP id F31E73CCCD; Sat, 10 Nov 2012 14:17:22 +0100 (CET) Message-ID: <509E53E2.5080908@net-b.de> Date: Sat, 10 Nov 2012 14:17:22 +0100 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121025 Thunderbird/16.0.2 MIME-Version: 1.0 To: Jakub Jelinek CC: gcc patches , Wei Mi , Kostya Serebryany , Xinliang David Li , Dodji Seketeli Subject: Re: [asan] Patch - fix an ICE in asan.c References: <509D6965.5040405@net-b.de> <20121110091658.GI1886@tucnak.redhat.com> In-Reply-To: <20121110091658.GI1886@tucnak.redhat.com> 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 Jakub Jelinek wrote: >> --- gcc/asan.c.orig 2012-11-09 21:26:26.000000000 +0100 >> +++ gcc/asan.c 2012-11-09 21:26:00.000000000 +0100 >> @@ -1362,6 +1362,8 @@ transform_statements (void) >> instrument_assignment (&i); >> else if (is_gimple_call (s)) >> maybe_instrument_call (&i); >> + if (gsi_end_p (i)) >> + break; >> } >> } >> } > > That looks a wrong place for this. I already expected that it was not fully correct ;-) > So untested: Thanks for the patch! It fixed the problem half way: It fixes the second issue I had (fail10.ii, http://gcc.gnu.org/ml/gcc-patches/2012-11/msg00791.html ). However, it didn't fix the original problem: As the call for strlen directly returns, it never reaches your patch. Hence, it doesn't fix fail31.ii of http://gcc.gnu.org/ml/gcc-patches/2012-11/msg00786.html If one uses the same line for strlen, it works. Updated patches attached – one is on top of the trunk + Dodji's patches, the other is on top of the asan branch. * * * The question is whether one also needs to do something for the atomics handling in maybe_instrument_builtin_call, which has: instrument_derefs (iter, dest, loc, is_store); return; The instrument_derefs calls - in some cases - build_check_stmt, which in turn calls: *iter = gsi_start_bb (else_bb) Tobias (This patch is for the "asan" branch.) 2012-11-10 Jakub Jelinek Tobias Burnus * asan.c (maybe_instrument_builtin_call): Set *iter to gsi for the call at the end. diff --git a/gcc/asan.c b/gcc/asan.c index 155e84b..3297b52 100644 --- a/gcc/asan.c +++ b/gcc/asan.c @@ -952,6 +952,7 @@ maybe_instrument_builtin_call (gimple_stmt_iterator *iter) case BUILT_IN_STRLEN: instrument_strlen_call (iter); + *iter = gsi_for_stmt (call); return true; /* And now the __atomic* and __sync builtins. @@ -1191,6 +1192,7 @@ maybe_instrument_builtin_call (gimple_stmt_iterator *iter) else if (dest != NULL_TREE) instrument_mem_region_access (dest, len, iter, loc, /*is_store=*/true); + *iter = gsi_for_stmt (call); return true; } return false;