From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id 97FD03984058; Fri, 9 Jul 2021 12:38:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 97FD03984058 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-2197] [Ada] Reorder preanalysis of static expression functions X-Act-Checkin: gcc X-Git-Author: Piotr Trojanek X-Git-Refname: refs/heads/master X-Git-Oldrev: e40f4ab46364c3e16c35c4d96c89187e8cae5a65 X-Git-Newrev: 81956c08f74be83aa61cba6c112b92cdc0198a66 Message-Id: <20210709123817.97FD03984058@sourceware.org> Date: Fri, 9 Jul 2021 12:38:17 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 12:38:17 -0000 https://gcc.gnu.org/g:81956c08f74be83aa61cba6c112b92cdc0198a66 commit r12-2197-g81956c08f74be83aa61cba6c112b92cdc0198a66 Author: Piotr Trojanek Date: Fri May 28 15:32:16 2021 +0200 [Ada] Reorder preanalysis of static expression functions gcc/ada/ * sem_ch6.adb (Analyze_Expression_Function): Reorder code. Diff: --- gcc/ada/sem_ch6.adb | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 0ecac3fed4e..d5432536846 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -524,6 +524,12 @@ package body Sem_Ch6 is Install_Formals (Def_Id); Preanalyze_Spec_Expression (Expr, Typ); End_Scope; + else + Push_Scope (Def_Id); + Install_Formals (Def_Id); + Preanalyze_Formal_Expression (Expr, Typ); + Check_Limited_Return (Orig_N, Expr, Typ); + End_Scope; end if; -- If this is a wrapper created in an instance for a formal @@ -561,16 +567,6 @@ package body Sem_Ch6 is end; end if; - -- Preanalyze the expression if not already done above - - if not Inside_A_Generic then - Push_Scope (Def_Id); - Install_Formals (Def_Id); - Preanalyze_Formal_Expression (Expr, Typ); - Check_Limited_Return (Orig_N, Expr, Typ); - End_Scope; - end if; - -- In the case of an expression function marked with the aspect -- Static, we need to check the requirement that the function's -- expression is a potentially static expression. This is done