From patchwork Fri Jun 29 22:34:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 168269 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 D1EDAB6F77 for ; Sat, 30 Jun 2012 08:40:19 +1000 (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=1341614420; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:User-Agent:MIME-Version:Message-Id: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=zTaVUHy 6m076ruZpyXZr/QXAl+A=; b=nZGqzZheKxP/szP6tHMHRGo6PIHNv7DfT67vSAd CRivxSHg01V/xmXasQYjM8S0nKI831xqr0mpwGGySY0vq8NS4AfDNuPCCqsvbdec u3fSeK1GeKgSo1/WColFEkb/oS9xFKGJ+V/u5+2VjNSPS3ADOgoQgN60wKwKJNmY UqzY= 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:From:To:Subject:Date:User-Agent:MIME-Version:Message-Id:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=li+/vBkpCf7MEj82pab4F4vujiwOtHh1Yw8rRWHUl3DQqHTM2OBI/dRhV2Uu9Z /bHxMJrpYjwIUautmqsVT16OQyMypnuLFBEwwkE+Zj/iVO95khr7K54O3GzxYCCz rO4/K1YVkXtUwUnB48l/XqBxGfEMAW7rRfFLJbMJqTc+U=; Received: (qmail 10268 invoked by alias); 29 Jun 2012 22:40:11 -0000 Received: (qmail 10260 invoked by uid 22791); 29 Jun 2012 22:40:10 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,TW_TM X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 29 Jun 2012 22:39:55 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 78ABA290038 for ; Sat, 30 Jun 2012 00:39:59 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id geZznsrTvP5g for ; Sat, 30 Jun 2012 00:39:59 +0200 (CEST) Received: from [192.168.1.2] (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 437D1290007 for ; Sat, 30 Jun 2012 00:39:59 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Fix oversight during try-finally lowering Date: Sat, 30 Jun 2012 00:34:10 +0200 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Message-Id: <201206300034.10660.ebotcazou@adacore.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 It pertains to the source location assigned to the finally switch: the comment in lower_try_finally_switch reads: /* The location of the finally is either the last stmt in the finally block or the location of the TRY_FINALLY itself. */ but the code reads: finally_loc = gimple_seq_last_stmt (tf->top_p_seq) != NULL ? gimple_location (gimple_seq_last_stmt (tf->top_p_seq)) : tf_loc; so it uses the location of last stmt of the eval block. Needless to say that this seriously screws up the coverage of the construct: the last stmt of the eval block is always reported as covered! Fixed thusly, tested on x86_64-suse-linux, applied on the mainline as obvious. This isn't a recent regression, but I took the liberty to put it on the 4.7 branch as well. 2012-06-29 Eric Botcazou * tree-eh.c (lower_try_finally_switch): Really put the location of the last statement of the finally block onto the switch. Index: tree-eh.c =================================================================== --- tree-eh.c (revision 189034) +++ tree-eh.c (working copy) @@ -1320,9 +1320,8 @@ lower_try_finally_switch (struct leh_sta /* The location of the finally is either the last stmt in the finally block or the location of the TRY_FINALLY itself. */ - finally_loc = gimple_seq_last_stmt (tf->top_p_seq) != NULL ? - gimple_location (gimple_seq_last_stmt (tf->top_p_seq)) - : tf_loc; + x = gimple_seq_last_stmt (finally); + finally_loc = x ? gimple_location (x) : tf_loc; /* Lower the finally block itself. */ lower_eh_constructs_1 (state, &finally);