From patchwork Mon Sep 28 07:35:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1372410 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@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=adacore-com.20150623.gappssmtp.com header.i=@adacore-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=ZMG2016l; dkim-atps=neutral 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 4C0Dnv4bL5z9sSn for ; Mon, 28 Sep 2020 17:35:29 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 658F33857004; Mon, 28 Sep 2020 07:35:26 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id 9E5A43857C59 for ; Mon, 28 Sep 2020 07:35:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9E5A43857C59 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=botcazou@adacore.com Received: by mail-wm1-x334.google.com with SMTP id s13so5669838wmh.4 for ; Mon, 28 Sep 2020 00:35:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=oKOHw7jIKr4bEQJ3rT4DwWIxnnsncCB1gSkIDdFYb4E=; b=ZMG2016lOXR03iKj85ySohzDlztm3wYLrv9us9z9EEAPCFo754+fkD/idqenJ1icl/ OLA4qO6A1+YaYHybZn667t96ibKo50lZkiTxqoGr36i0HdCn1vIucdUUA703KTiAAJzd WfA5ASHeAZJO9Mdyrolj8vKbXQJjY7F58EyLna3phNAuZiwOvGvGoL6cd1bdiE3AYDiA O3hlnUwQ8RubkBhsPA8ObNacCCyI6YSR3FpY0RyGNO0dZVk9U929X+ST2HfKOlFb1VhG TxsdUUUB47rIWZbdo1pRpJQYTqcG3jxBufw8HRuVXC4RUOrYfcqfSHgkJ8KAmc9Rbwe5 kckg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=oKOHw7jIKr4bEQJ3rT4DwWIxnnsncCB1gSkIDdFYb4E=; b=cWkNKRhkjOwDZBuEUw4a3OdDCuvxMnLuolrT/FwCruRSHFtAi0Yk1xUIFjHwfoDLZ/ 9LQ8UxkGq5yIQeBrmklzVCZTFcNXJZun56UxGSDYcDISP7WY4Ups9NGUDmUN2Ry9TdDE bFmti+sYddoWL3KfSb/PLv9b0seGUw1+C5Y2vEhvlXIsICaTB8IogwAse1gigzWOgkJa dweVFF5PZMt0gxUDo25UQ124tblPJlaC3iVN8YXkPS4K3oUoGpplHlBnHFK8rpW/OGA8 Z4f0jmXOHiaSJ2uv4Cfcd/dC6w1m0h0ViSczRimqsTjJp6o4j+7l8gwKD36VXk47NQsu cylw== X-Gm-Message-State: AOAM5337xBps6COkCdw5MjYQo8Jjy1lKWdpTMLogSCJIXZ9zLuqcl58U UC4fyp9KY/oqM3sbF5BodLJXPa9DIts4uPmD X-Google-Smtp-Source: ABdhPJzOMadxoUzNAQdEi4p9DWjhHeWlNg2oNSE8TfR3j7DAacv5AObkGGumlyfwOEC2W7RN4NpE2Q== X-Received: by 2002:a7b:c4d1:: with SMTP id g17mr143563wmk.167.1601278522191; Mon, 28 Sep 2020 00:35:22 -0700 (PDT) Received: from fomalhaut.localnet ([2a01:e0a:41b:9230:7f82:53f4:769e:54b6]) by smtp.gmail.com with ESMTPSA id c14sm234476wrv.12.2020.09.28.00.35.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Sep 2020 00:35:21 -0700 (PDT) From: Eric Botcazou X-Google-Original-From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Add missing end location information Date: Mon, 28 Sep 2020 09:35:08 +0200 Message-ID: <2735929.ri9RJRQ35B@fomalhaut> MIME-Version: 1.0 X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_SHORT, RCVD_IN_DNSWL_NONE, 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: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" In some cases we would fail to put the end location information on the outermost BIND_EXPR of a function, which is problematic when there is a dynamic stack allocation. Tested on x86_64-suse-linux, applied on the mainline. This makes the following tweak to lower_try_finally_dup_block obsolete: https://gcc.gnu.org/pipermail/gcc-patches/2020-September/553951.html so I reverted it. 2020-09-28 Eric Botcazou * gcc-interface/trans.c (Subprogram_Body_to_gnu): Set the end locus of body and declaration earlier. diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 3491451cc3d..f03d591a323 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -4017,6 +4017,11 @@ Subprogram_Body_to_gnu (Node_Id gnat_node) gnat_poplevel (); gnu_result = end_stmt_group (); + /* Attempt setting the end_locus of our GCC body tree, typically a BIND_EXPR, + then the end_locus of our GCC subprogram declaration tree. */ + set_end_locus_from_node (gnu_result, gnat_node); + set_end_locus_from_node (gnu_subprog_decl, gnat_node); + /* If we populated the parameter attributes cache, we need to make sure that the cached expressions are evaluated on all the possible paths leading to their uses. So we force their evaluation on entry of the function. */ @@ -4111,12 +4116,6 @@ Subprogram_Body_to_gnu (Node_Id gnat_node) gnu_return_label_stack->pop (); - /* Attempt setting the end_locus of our GCC body tree, typically a - BIND_EXPR or STATEMENT_LIST, then the end_locus of our GCC subprogram - declaration tree. */ - set_end_locus_from_node (gnu_result, gnat_node); - set_end_locus_from_node (gnu_subprog_decl, gnat_node); - /* On SEH targets, install an exception handler around the main entry point to catch unhandled exceptions. */ if (DECL_NAME (gnu_subprog_decl) == main_identifier_node