From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1285) id D4F5D3875DD3; Wed, 27 Sep 2023 08:28:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D4F5D3875DD3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1695803316; bh=QxQQ/jwzZxJwIbNGCopmBcnHmcKys+HLe714+hvbso4=; h=From:To:Subject:Date:From; b=kghH9sZNQGOl8sRPEVDNVv4RZT/c+cHi5WfTTbZXnZJ00kyWRQe0uDGuFNsOcXDxp 5Eszlm6mUnCwsCn2KYlGhD/DaVH3xl2OMjK3AnJ+KlkcEDsD8pHpxaaF2aCV/wMAnU mf9MUJLJGO4RcJy0zsMFOa7ercEY9+pqAH0mJSvc= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Eric Botcazou To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-7907] ada: Fix internal error on expression function with Refined_Post aspect X-Act-Checkin: gcc X-Git-Author: Eric Botcazou X-Git-Refname: refs/heads/releases/gcc-13 X-Git-Oldrev: 90f7f814920c48a7c90d98ad5b6bb1cb9851e9d2 X-Git-Newrev: 419e0f26eaa57b0fe7cdda5fd7303318bdbe9e78 Message-Id: <20230927082836.D4F5D3875DD3@sourceware.org> Date: Wed, 27 Sep 2023 08:28:36 +0000 (GMT) List-Id: https://gcc.gnu.org/g:419e0f26eaa57b0fe7cdda5fd7303318bdbe9e78 commit r13-7907-g419e0f26eaa57b0fe7cdda5fd7303318bdbe9e78 Author: Eric Botcazou Date: Tue Sep 5 13:21:24 2023 +0200 ada: Fix internal error on expression function with Refined_Post aspect This occurs when the expression function calls a protected function and the -gnata switch is specified, because the compiler wrongly freezes the called function when analyzing the expression function, a fallout of the wrapping scheme used for the Post and Refined_Post aspects. gcc/ada/ * sem_res.adb (Resolve_Call): When the target is an entity, do not freeze it if the current scope is the inner wrapper function built for an expression function with a Post or Refined_Post aspect. Diff: --- gcc/ada/sem_res.adb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 8a20a8df5b6..3683de199e5 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -6578,6 +6578,9 @@ package body Sem_Res is if Is_Entity_Name (Subp) and then not In_Spec_Expression and then not Is_Expression_Function_Or_Completion (Current_Scope) + and then not (Chars (Current_Scope) = Name_uWrapped_Statements + and then Is_Expression_Function_Or_Completion + (Scope (Current_Scope))) and then (not Is_Expression_Function_Or_Completion (Entity (Subp)) or else Expander_Active)