public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Eric Botcazou <ebotcazou@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-7907] ada: Fix internal error on expression function with Refined_Post aspect
Date: Wed, 27 Sep 2023 08:28:36 +0000 (GMT)	[thread overview]
Message-ID: <20230927082836.D4F5D3875DD3@sourceware.org> (raw)

https://gcc.gnu.org/g:419e0f26eaa57b0fe7cdda5fd7303318bdbe9e78

commit r13-7907-g419e0f26eaa57b0fe7cdda5fd7303318bdbe9e78
Author: Eric Botcazou <ebotcazou@adacore.com>
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)

                 reply	other threads:[~2023-09-27  8:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230927082836.D4F5D3875DD3@sourceware.org \
    --to=ebotcazou@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).