From patchwork Tue Sep 6 07:16:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1029 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp507459wrt; Tue, 6 Sep 2022 00:31:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR74krImQ7JGur9KMOANBUZ5e4agQiZl/sD4N63bvaiPTCh9Z/r+t+kebBd2DzI2+iQh3+OG X-Received: by 2002:a05:6402:2945:b0:446:1144:f1aa with SMTP id ed5-20020a056402294500b004461144f1aamr45565148edb.79.1662449492991; Tue, 06 Sep 2022 00:31:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662449492; cv=none; d=google.com; s=arc-20160816; b=FeQcZ2gT1D5u0HWOvz67vCwLEcErGZ3uUpudyeIBHb9ua3Ov5fVu73l0TbLpZADgEd yRe72lxRTENVldJbcuXKEB6FL8dVu4ZpnGGdTa+MgVuY6qKFmbhDNL9vcwizRCegjEVr 6C5/8iKvf5dHAz/jI9JXqK8d5QUqUOYeAHEK3l1UK7GKB9/QUrVbFQXT4+pIV2M+3CYP OH+SThBwuXhS3mZmumAETaLUwwSkEDr7rBxFSoZPUoCpc718pFo0eRl7jaYaVO3abofD /hYTAtdWZl3L73E7tKkWDNK4NvuiFTtyBl3c4ZKwjJxXn7wmgTz8xXWAx0NbwZKx1O/C 4Tkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=aSRS3edLOjXq9rNNjUaJTZGYpc2twMVM2ei3zpcvFkM=; b=IC9NV5mtMBBUlvqwzsTc8lYv2EmHiYW57uGCf00IBo9+/i59YouuM8ZyzMVMmAg3yw xtaUN6QH1Y3RLQRJTmNnidLjSeqiPjlfD/zMHbAJrPFIShSF3BiwoiDPzs5e0iRRCbTr Kv0QcpvOEvJGf3gafyoeDzPLEYWt5YHvZQX3X+9SAyM+47T/JiHbKzQmNEjC3micU/O/ sv3XNATgZJk3z3bVy5YctnCNg2szEyAGPYoB7/ABfvYU4RNY9Fd9ONTTG22rhXe61K4Y tKwmAzFPWcWL5ZwuvaqzFaiWpLmjRlvLx3vE+ea8xOm2odXO2uroBiNUE5BrxA0cuqdA WBMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=SddI1Dy3; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id l13-20020a50d6cd000000b00448b72c6f0esi8117182edj.301.2022.09.06.00.31.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 00:31:32 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=SddI1Dy3; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9CD0B396D80C for ; Tue, 6 Sep 2022 07:24:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9CD0B396D80C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662449070; bh=aSRS3edLOjXq9rNNjUaJTZGYpc2twMVM2ei3zpcvFkM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=SddI1Dy3539I/FpWDEvkjVELjkcodrxh5+E0h9pVgEAnugfrtmF8Xpmi7Nc7Osvb1 EKrO+3q0tKXKlYwobG09/lTGOA0KW+LVzYAaNC/MModHlIuorpKGn9dI9Aw5o9irvq W/JxiHRVcwuczuPa8BXDl63xIaj9oLbEbqkv8mqI= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 7D4563850862 for ; Tue, 6 Sep 2022 07:16:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7D4563850862 Received: by mail-wr1-x436.google.com with SMTP id b16so14017252wru.7 for ; Tue, 06 Sep 2022 00:16:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=aSRS3edLOjXq9rNNjUaJTZGYpc2twMVM2ei3zpcvFkM=; b=5k06AAlDFOyAI3N2VjqhW+sWQMYySNzM9H79C4mUae0ZnK3/afQoMMbCaut3gqkOlC WcoQ7GoG3rjmVWFIHl1JsSrDRR+C9vgqQ9DnfGeH6tnWmM1zs4VCeF/13w8ZSdt0wtjQ nppIFqVK21SFl6GB9uqqbLzwY6x9CyiKWscnbFJgmEvwkpbtw4bTNBCF3cBpHA+nmvpm e6yNQgEWuWtl3OoEOUrXqHH3rXIQN1RuYm6k9AcozbwViuSwWEm1PWGWuJpqrpZVevzU Xh2YRzfPrEEAtYcbZO+M9IDeadi1k/rKwlVkKRtGf68hZcqON+svtjbvGiMErgRxv9HY xvTw== X-Gm-Message-State: ACgBeo3pviW8687WtR7EUXwOAhlJ0SxmgWo8fKWbgsBTn7a2yUL42DCN fd13v9nO/2AeD3sWykc5BIXKMCkM/TrF+Q== X-Received: by 2002:a5d:5581:0:b0:20f:fc51:7754 with SMTP id i1-20020a5d5581000000b0020ffc517754mr27436787wrv.413.1662448566180; Tue, 06 Sep 2022 00:16:06 -0700 (PDT) Received: from poulhies-Precision-5550 (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id p28-20020a05600c1d9c00b003a5b788993csm13748376wms.42.2022.09.06.00.16.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 00:16:05 -0700 (PDT) Date: Tue, 6 Sep 2022 09:16:05 +0200 To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix problematic line debug info attached to call to finalizer Message-ID: <20220906071605.GA1280575@poulhies-Precision-5550> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: , X-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: Marc =?iso-8859-1?q?Poulhi=E8s?= Cc: Eric Botcazou Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1743204639210312897?= X-GMAIL-MSGID: =?utf-8?q?1743204639210312897?= The End_Label is not defined for body nodes so a small tweak is needed. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * gcc-interface/trans.cc (At_End_Proc_to_gnu): Use the End_Label of the child Handled_Statement_Sequence for body nodes. (set_end_locus_from_node): Minor tweaks. diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc --- a/gcc/ada/gcc-interface/trans.cc +++ b/gcc/ada/gcc-interface/trans.cc @@ -3806,18 +3806,27 @@ static void At_End_Proc_to_gnu (Node_Id gnat_node) { tree proc_decl = gnat_to_gnu (At_End_Proc (gnat_node)); + Node_Id gnat_end_label; /* When not optimizing, disable inlining of finalizers as this can create a more complex CFG in the parent function. */ if (!optimize || optimize_debug) DECL_DECLARED_INLINE_P (proc_decl) = 0; + /* Retrieve the end label attached to the node, if any. */ + if (Nkind (gnat_node) == N_Handled_Sequence_Of_Statements) + gnat_end_label = End_Label (gnat_node); + else if (Present (Handled_Statement_Sequence (gnat_node))) + gnat_end_label = End_Label (Handled_Statement_Sequence (gnat_node)); + else + gnat_end_label = Empty; + /* If there is no end label attached, we use the location of the At_End procedure because Expand_Cleanup_Actions might reset the location of - the enclosing construct to that of an inner statement. */ + the enclosing construct to that of an inner statement. */ add_cleanup (build_call_n_expr (proc_decl, 0), - Present (End_Label (gnat_node)) - ? End_Label (gnat_node) : At_End_Proc (gnat_node)); + Present (gnat_end_label) + ? gnat_end_label : At_End_Proc (gnat_node)); } /* Subroutine of gnat_to_gnu to translate GNAT_NODE, an N_Subprogram_Body. */ @@ -10418,7 +10427,6 @@ set_end_locus_from_node (tree gnu_node, Node_Id gnat_node) gnat_end_label = End_Label (Handled_Statement_Sequence (gnat_node)); else gnat_end_label = Empty; - break; case N_Package_Declaration: @@ -10439,7 +10447,7 @@ set_end_locus_from_node (tree gnu_node, Node_Id gnat_node) transient block does not receive the sloc of a source condition. */ if (!Sloc_to_locus (Sloc (gnat_node), &end_locus, No (gnat_end_label) - && (Nkind (gnat_node) == N_Block_Statement))) + && Nkind (gnat_node) == N_Block_Statement)) return false; switch (TREE_CODE (gnu_node))