From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1285) id BAF463858D39; Mon, 6 Mar 2023 10:50:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BAF463858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678099809; bh=or38+aFS8CRREZorMrSEHhTZP0zd5ewHmZqSeFfIhGQ=; h=From:To:Subject:Date:From; b=ggPqbx4RJnpcQbiuIweReF/eYGaspD/99W0khz6ZJyzIc/0x+sQAkVS7tpGsG/a/A w9OTgAPzXAUFg7q5nLbZAUCMuO1Ptmws56a6UMXxEughQrPYY4j/dGXjfF5TmtJ7vL y4PH42bq90hwG6ZXyIWyXd1esbx+pExEMEFp2dpk= 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-6505] Fix assertion failure on VSS library X-Act-Checkin: gcc X-Git-Author: Javier Miranda X-Git-Refname: refs/heads/master X-Git-Oldrev: 94a67e3044212592ce408952c526210a81e1bf49 X-Git-Newrev: 14e5b65fd9bb6a848adda8ec939840c8f3ea6b40 Message-Id: <20230306105009.BAF463858D39@sourceware.org> Date: Mon, 6 Mar 2023 10:50:09 +0000 (GMT) List-Id: https://gcc.gnu.org/g:14e5b65fd9bb6a848adda8ec939840c8f3ea6b40 commit r13-6505-g14e5b65fd9bb6a848adda8ec939840c8f3ea6b40 Author: Javier Miranda 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