From patchwork Wed Jun 16 08:43:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 1492809 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G4f590fbdz9sXL for ; Wed, 16 Jun 2021 18:49:48 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0EAFC398B858 for ; Wed, 16 Jun 2021 08:49:46 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTPS id 2512B3989009 for ; Wed, 16 Jun 2021 08:43:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2512B3989009 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id C88B31173F4; Wed, 16 Jun 2021 04:43:55 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com 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 0p2mfbRoZCYb; Wed, 16 Jun 2021 04:43:55 -0400 (EDT) Received: from tron.gnat.com (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) by rock.gnat.com (Postfix) with ESMTP id B1948117762; Wed, 16 Jun 2021 04:43:55 -0400 (EDT) Received: by tron.gnat.com (Postfix, from userid 4862) id ADA4C180; Wed, 16 Jun 2021 04:43:55 -0400 (EDT) Date: Wed, 16 Jun 2021 04:43:55 -0400 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix ALI source location for dominance markers Message-ID: <20210616084355.GA95226@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthieu Eyraud Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" As First_Sloc is used to compute source location for entry guards, it must be also used to compute the dominance marker source location in this particular case (when a statement is dominated by an entry guard). Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * par_sco.adb (Set_Statement_Entry): Change sloc for dominance marker. (Traverse_One): Fix typo. (Output_Header): Fix comment. diff --git a/gcc/ada/par_sco.adb b/gcc/ada/par_sco.adb --- a/gcc/ada/par_sco.adb +++ b/gcc/ada/par_sco.adb @@ -683,9 +683,12 @@ package body Par_SCO is -- two 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 first sloc of the condition itself - -- (note: we use First_Sloc, not Sloc, because this is what is - -- referenced by dominance markers). + -- the WHEN, so we use the first sloc of the condition itself. + -- First_Sloc gives the most sensible result, but we have to + -- beware of also using it when computing the dominance marker + -- sloc (in the Set_Statement_Entry procedure), as this is not + -- fully equivalent to the "To" sloc computed by + -- Sloc_Range (Guard, To, From). -- Doesn't this requirement of using First_Sloc need to be -- documented in the spec ??? @@ -1579,6 +1582,18 @@ package body Par_SCO is To := No_Location; end if; + -- Be consistent with the location determined in + -- Output_Header. + + if Current_Dominant.K = 'T' + and then Nkind (Parent (Current_Dominant.N)) + in N_Accept_Alternative + | N_Delay_Alternative + | N_Terminate_Alternative + then + From := First_Sloc (Current_Dominant.N); + end if; + Set_Raw_Table_Entry (C1 => '>', C2 => Current_Dominant.K, @@ -1867,7 +1882,7 @@ package body Par_SCO is Process_Decisions_Defer (Cond, 'G'); -- For an entry body with a barrier, the entry body - -- is dominanted by a True evaluation of the barrier. + -- is dominated by a True evaluation of the barrier. Inner_Dominant := ('T', N); end if;