From patchwork Mon Jul 23 08:12:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 172569 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 AD5122C0262 for ; Mon, 23 Jul 2012 18:13:22 +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=1343636003; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID: 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=svW6o3fBIoqXCb/zAzJN IZrBvhc=; b=stoLHMGkYBjaSovcUaNIEfFtfO483r3WZkKvl3Nk3e6fr1/CbS/w gHd7rTghBGuJFKywfWnfZ5RZ9pStz3W+5fZhVwuDT6w0rj/dqs9TokEBw4WT5ISV SvyBThkmF43svtpI9Wzexd5bQuiHWM6s1uBGZAh1aYRkcOZV1VjsX5k= 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:MIME-Version:Content-Type:Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=eE0qx62Zyo1BbTzAbXvnbW+N0P5PuAa1ldj7U8bBB4/Wov1XqcZ0O/GzzCaVdO yc/wCl3UnTXgi7+kUywbtkJicQGQmvUG79rNFVPIyd5NoaGiJGzq38twJQEpYVy0 k8GUTyfosY4BXdGm/BzhojBitsehkkLsz5i8J+GptUsZ8=; Received: (qmail 26130 invoked by alias); 23 Jul 2012 08:13:06 -0000 Received: (qmail 26016 invoked by uid 22791); 23 Jul 2012 08:13:04 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_NO X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 23 Jul 2012 08:12:51 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 4E2441C7535; Mon, 23 Jul 2012 04:12:50 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id vAzZx3H4gYEW; Mon, 23 Jul 2012 04:12:50 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 34EE11C7533; Mon, 23 Jul 2012 04:12:50 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id 3359092BF6; Mon, 23 Jul 2012 04:12:50 -0400 (EDT) Date: Mon, 23 Jul 2012 04:12:50 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Thomas Quinot Subject: [Ada] Fix to SCOs for SELECT alternatives with guard Message-ID: <20120723081250.GA5030@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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 This change fixes incorrect source location indications in SCOs for decisions corresponding to guard expressions in SELECT statements, which can cause a crash in coverage analysis tools. Tested on x86_64-pc-linux-gnu, committed on trunk 2012-07-23 Thomas Quinot * par_sco.adb (Process_Decisions.Output_Header): For the guard on an alternative in a SELECT statement, use the First_Sloc of the guard expression (not its topmost sloc) as the decision location, because this is what is referenced by dominance markers. Index: par_sco.adb =================================================================== --- par_sco.adb (revision 189768) +++ par_sco.adb (working copy) @@ -25,6 +25,7 @@ with Atree; use Atree; with Debug; use Debug; +with Errout; use Errout; with Lib; use Lib; with Lib.Util; use Lib.Util; with Namet; use Namet; @@ -495,13 +496,15 @@ -- levels (through the pragma argument association) to get to -- the pragma node itself. For the guard on a select -- alternative, we do not have access to the token location - -- for the WHEN, so we use the sloc of the condition itself. + -- for the WHEN, so we use the first sloc of the condition + -- itself (note: we use First_Sloc, not Sloc, because this is + -- what is referenced by dominance markers). if Nkind_In (Parent (N), N_Accept_Alternative, N_Delay_Alternative, N_Terminate_Alternative) then - Loc := Sloc (N); + Loc := First_Sloc (N); else Loc := Sloc (Parent (Parent (N))); end if;