From patchwork Tue Sep 6 07:15:53 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: 1023 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp506167wrt; Tue, 6 Sep 2022 00:26:56 -0700 (PDT) X-Google-Smtp-Source: AA6agR5T9STWFFlHykVEDswR7/Od42kk3KTOLdHp2KtzksPzSBPNNtcq4pCr8wflZ0gsTBnip4Z5 X-Received: by 2002:a05:6402:501d:b0:443:1c7:ccb9 with SMTP id p29-20020a056402501d00b0044301c7ccb9mr46782604eda.101.1662449216693; Tue, 06 Sep 2022 00:26:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662449216; cv=none; d=google.com; s=arc-20160816; b=c1KDr8jolyaiBFY4ZBWvLyqIvYeD3RfVOmVXHwp3gL9anXTCbmM9riwkHne94tJSMt 9GTinU/4cntXFzQ+wQDe8jAphfPtybo8tnWBhwo8KDhSG4hJR4yZ78nDqX4w6vrqZv1x HX7q63vvREpWIFNdZwW3IOchlPUviIen/MUVJc5DbtyUXs8eVKuUfS52QfJFJRppCTqD Hrth80WrK6EWIn8A06NSWQ5Q/L5e60iT0I3OFIrcc8eG6FM4MRCG1o/WR4THXT0te4Ig BsqCXKdoPUGjTO+3UIHjsbch2mkrvIW5Bta9kjy/kev12yEyke4/EKW3dlwtUbvIygup RTEg== 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=LTjz+HJT0aIPjeX6BqEhh9haYN1DVLNVwiEZmPrbO9M=; b=Ut9OSbq/uB+wYS2o6AQSkK7YugbU45t9tR6H6OFwwpdhVWiicK5CKuLUhvcSxUiKWQ 6LClBkkBrk0/Sb2M7BHLMrw2SL7FQsecnYpcx/Tg0cxSETXrUfS8zHOtrkoMDxctjAP7 x0PwgbUoEYuz2l9/PbrgemEX2bLpxBJ0MDyiUuKVBN0os2UIoijhgYGDZrhFYv4195/5 k4DlKw45MIi3BHNS+ymEPxXqYS22QTOyifClphcC/1PyPStWzWkbuINI69nG46oHOl30 hwG1bQEoyz8qUbY8Qfb2lPUvnUdeQh6ua96vh6AlpIikSEc3mh2SXmESk33fBPq2+6Md Wk8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=sMRRaz7z; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id di4-20020a170906730400b0072f190400f7si9152803ejc.1.2022.09.06.00.26.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 00:26:56 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=sMRRaz7z; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 C747E3955C91 for ; Tue, 6 Sep 2022 07:21:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C747E3955C91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662448889; bh=LTjz+HJT0aIPjeX6BqEhh9haYN1DVLNVwiEZmPrbO9M=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=sMRRaz7zM1kHpAlq4DNbW4lTe0LhPDzD7NtWtc2PxW2rAVIGz0G46Ac76q0+OfreG juYo6Z9DJdICylNbaT4aIaiZZeTlhyG+5jRwapJ67cZEE9jt8RssLq+iq7ITIGxGzY 8X/+3MJe5ko34D3e0kZSm717LgWxCCs6sufvfi1k= 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 D1423385116A for ; Tue, 6 Sep 2022 07:15:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D1423385116A Received: by mail-wr1-x436.google.com with SMTP id b17so671335wrq.3 for ; Tue, 06 Sep 2022 00:15:55 -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=LTjz+HJT0aIPjeX6BqEhh9haYN1DVLNVwiEZmPrbO9M=; b=jGMNzDscCGgNPzLCPOQTm2pmvERgAiv4B2XdiMk90VZ7TaVv65atHjKVD5Lmp2/cg3 t8NRu3kttcCKspwc5II++Mx4DlmRd+62M5addjgvum+uJPECbzC5jsxlvgNPvcSIgvbr U/AbNEJ6ZU0CMJLcpr2143ByoZTVFoAabbwzkVfFLHtSx9+BUULuz22l+XO0pIkMecPY PLA4YDb3TdbdN3c958zKZup93zX+SaYW6GEbXZmlHg/4YdVK23+KLsIH4lbeGiGSA0jw CrPl+o4ryN481dbmaGs4OJrSmgvHy0C2wD0xk0MFvU0ppCSSpQbVOI2CqFlgGhAFijzo ABQQ== X-Gm-Message-State: ACgBeo2BfJqND/ooxF5e4Z3k90S6vldypQRUzJYn4f3g/9JvKCLlX4rA 4VEo0SfVpsmz4mLJLvmh2iq9S/kJ0lw4ow== X-Received: by 2002:adf:fa12:0:b0:228:62a8:7c79 with SMTP id m18-20020adffa12000000b0022862a87c79mr6862634wrr.231.1662448554816; Tue, 06 Sep 2022 00:15:54 -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 p7-20020a05600c358700b003a8418ee646sm21689802wmq.12.2022.09.06.00.15.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 00:15:54 -0700 (PDT) Date: Tue, 6 Sep 2022 09:15:53 +0200 To: gcc-patches@gcc.gnu.org Subject: [Ada] Handle new At_End expansion during unnesting Message-ID: <20220906071553.GA1280406@poulhies-Precision-5550> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-12.9 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: Justin Squirek 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?1743204350109970824?= X-GMAIL-MSGID: =?utf-8?q?1743204350109970824?= This patch modifies the marking of nested subprograms requiring static links, so that the changes made to "At end" procedures get handled properly. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_unst.adb (Visit_Node): Add N_Block_Statement to the enclosing construct case since they can now have "At end" procedures. Also, recognize calls from "At end" procedures when recording subprograms. diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb --- a/gcc/ada/exp_unst.adb +++ b/gcc/ada/exp_unst.adb @@ -938,7 +938,7 @@ package body Exp_Unst is -- subprogram. As above, the called entity must be local and -- not imported. - when N_Handled_Sequence_Of_Statements => + when N_Handled_Sequence_Of_Statements | N_Block_Statement => if Present (At_End_Proc (N)) and then Scope_Within (Entity (At_End_Proc (N)), Subp) and then not Is_Imported (Entity (At_End_Proc (N))) @@ -1184,6 +1184,15 @@ package body Exp_Unst is Register_Subprogram (Ent, N); + -- Record a call from an At_End_Proc + + if Present (At_End_Proc (N)) + and then Scope_Within (Entity (At_End_Proc (N)), Subp) + and then not Is_Imported (Entity (At_End_Proc (N))) + then + Append_Unique_Call ((N, Ent, Entity (At_End_Proc (N)))); + end if; + -- We make a recursive call to scan the subprogram body, so -- that we can save and restore Current_Subprogram.