From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7871) id 69C1738582BD; Fri, 15 Sep 2023 13:04:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 69C1738582BD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694783079; bh=yn4+cvhA03TfwdumXbn3Mxn/dTm+Y/Gg37YxdltX02E=; h=From:To:Subject:Date:From; b=hgVqh2xg59WGXXtNZKEdvrtT6l4B+/IQgdCzvQl7NSVrOP3pkZOmXJIY9EiKjqN6h GstAE2lOA+EqqCwDWmhGuw34HpicC4S/5ldecnTwiv9z49ob+qS2ClQcZnGUerdahL 4GWCvqSKU991YWAg11rIZPgCFDuj2szoo4py6s70= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Marc Poulhi?s To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-4025] 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/master X-Git-Oldrev: 553c37bedcfb04f52237ef3cdd2a19747c61cde1 X-Git-Newrev: ef49cc3890587bcb7ce50801d10c9658a59479dd Message-Id: <20230915130439.69C1738582BD@sourceware.org> Date: Fri, 15 Sep 2023 13:04:39 +0000 (GMT) List-Id: https://gcc.gnu.org/g:ef49cc3890587bcb7ce50801d10c9658a59479dd commit r14-4025-gef49cc3890587bcb7ce50801d10c9658a59479dd 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 c708d04fc32..b8d8e701ae3 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -6582,6 +6582,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)