From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wr1-x436.google.com with SMTP id b17so671335wrq.3 for ; Tue, 06 Sep 2022 00:15:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date; bh=LTjz+HJT0aIPjeX6BqEhh9haYN1DVLNVwiEZmPrbO9M=; b=N47V0ZnFj7wqL/y2XEkSjgc52tOAyYVkswDV/K2nKDqPfMpT/8FZVqTVk/pjTiPtCm YjZet2zzt2bM7zEC/lQhK2JFvLZ8xPz5C4ZvcEDkriD+n5MzNuJJhUMQwvEQHjX5jCX0 3JaUuk0wDkr+/PlR0Kt4ZEqH4CfIcXzmeryG/WqtyuYiBV9kIKs/iLqrezSP0K4IuJC5 Wx0CKhUfr/ppxXwvM3jUfMHTSPG43OmamFe6yhnJyaRnn67vDGQSqqTiafAKrBNWjNa6 xmtjfB5/3wcGWDgIeqAri3CNl+BNdZ6dEc9Wg7otfL4YjBjDQt71UysLj8wuTYG0MxXP xdbA== 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-Google-Smtp-Source: AA6agR4GOXrVvK5A44L0YIaUsiyihqGGJ5gY1433lrwYZpMJSwGx7A8ztkwni3VpBRrQ1BvhC0xQcQ== 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 From: Marc =?iso-8859-1?Q?Poulhi=E8s?= To: gcc-patches@gcc.gnu.org Cc: Justin Squirek Subject: [Ada] Handle new At_End expansion during unnesting Message-ID: <20220906071553.GA1280406@poulhies-Precision-5550> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="opJtzjQTFsWo+cga" 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 List-Id: --opJtzjQTFsWo+cga Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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. --opJtzjQTFsWo+cga Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" 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. --opJtzjQTFsWo+cga--