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-6505] Fix assertion failure on VSS library
Date: Mon,  6 Mar 2023 10:50:09 +0000 (GMT)	[thread overview]
Message-ID: <20230306105009.BAF463858D39@sourceware.org> (raw)

https://gcc.gnu.org/g:14e5b65fd9bb6a848adda8ec939840c8f3ea6b40

commit r13-6505-g14e5b65fd9bb6a848adda8ec939840c8f3ea6b40
Author: Javier Miranda <miranda@adacore.com>
Date:   Mon Mar 6 11:43:28 2023 +0100

    Fix assertion failure on VSS library
    
    gcc/ada/
            PR ada/108858
            * sem_ch6.adb (Analyze_Subprogram_Body_Helper): For functions with
            separate spec, if their return type was visible through a limited-
            with context clause, their extra formals were not added when the
            spec was analyzed.  Now the full view must be available, and the
            extra formals can be created and Returns_By_Ref computed.

Diff:
---
 gcc/ada/sem_ch6.adb | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 944e6381072..d4701aed0f7 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -3836,6 +3836,21 @@ package body Sem_Ch6 is
          Spec_Decl := Unit_Declaration_Node (Spec_Id);
          Verify_Overriding_Indicator;
 
+         --  For functions with separate spec, if their return type was visible
+         --  through a limited-with context clause, their extra formals were
+         --  not added when the spec was frozen. Now the full view must be
+         --  available, and the extra formals can be created and Returns_By_Ref
+         --  computed (required to generate its return statements).
+
+         if Ekind (Spec_Id) = E_Function
+           and then From_Limited_With (Etype (Spec_Id))
+           and then Is_Build_In_Place_Function (Spec_Id)
+           and then not Has_BIP_Formals (Spec_Id)
+         then
+            Create_Extra_Formals (Spec_Id);
+            Compute_Returns_By_Ref (Spec_Id);
+         end if;
+
          --  In general, the spec will be frozen when we start analyzing the
          --  body. However, for internally generated operations, such as
          --  wrapper functions for inherited operations with controlling

                 reply	other threads:[~2023-03-06 10:50 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=20230306105009.BAF463858D39@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).