From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id 50BE53857343; Mon, 30 May 2022 08:30:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 50BE53857343 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 r13-834] [Ada] Do not analyze expression functions for dispatch tables X-Act-Checkin: gcc X-Git-Author: Eric Botcazou X-Git-Refname: refs/heads/master X-Git-Oldrev: 764169055b5b083f1f2167122c637ddc72c58095 X-Git-Newrev: 79b7ab68bce24103adc388d184ff74755914cdda Message-Id: <20220530083037.50BE53857343@sourceware.org> Date: Mon, 30 May 2022 08:30:37 +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: Mon, 30 May 2022 08:30:37 -0000 https://gcc.gnu.org/g:79b7ab68bce24103adc388d184ff74755914cdda commit r13-834-g79b7ab68bce24103adc388d184ff74755914cdda Author: Eric Botcazou Date: Fri Apr 22 22:27:22 2022 +0200 [Ada] Do not analyze expression functions for dispatch tables There is no need to analyze expression functions that are primitives of a tagged type for its dispatch table because they will be analyzed at the end of the current scope. gcc/ada/ * sem_attr.adb (Resolve_Attribute) : Don't analyze the body of an expression function in the case of a dispatch table. Diff: --- gcc/ada/sem_attr.adb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 7b05cdc2bd6..e6e06f605fa 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -12144,11 +12144,15 @@ package body Sem_Attr is elsif Scope (Subp_Id) /= Current_Scope then null; + -- Dispatch tables are not a freeze point either + + elsif Nkind (Parent (N)) = N_Unchecked_Type_Conversion + and then Is_Dispatch_Table_Entity (Etype (Parent (N))) + then + null; + -- Analyze the body of the expression function to freeze - -- the expression. This takes care of the case where the - -- 'Access is part of dispatch table initialization and - -- the generated body of the expression function has not - -- been analyzed yet. + -- the expression. else Analyze (Subp_Body);