From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7871) id BECBD385840D; Tue, 27 Jun 2023 12:07:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BECBD385840D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687867660; bh=bQnBookSnKKRmkoFTUKVKnJPKNIJuFuSZp+htTqPoiM=; h=From:To:Subject:Date:From; b=BVnNy+fyYJwc8SWDpDujojDbHKnZCUnZJzZEQ7KrgYiF1o33mDCJbHbZNT+EpzWX1 wdi6fSwjA9ZGm9RmtORWAV64RJ/2J877WrsGR3SB6+tSQKAv8mlQ6Gv0E7Zz8hq3ec +aEPJVCbIbMAJXXOD6mAR4nX9GbVPbPMVGGwFRSA= 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-2124] ada: Plug another loophole in the handling of private views in instances X-Act-Checkin: gcc X-Git-Author: Eric Botcazou X-Git-Refname: refs/heads/master X-Git-Oldrev: f404dd44078fdecf83b142831d6cc6f52f3a76b6 X-Git-Newrev: 125a2260ce07e384238f8569c77d07c56762d39c Message-Id: <20230627120740.BECBD385840D@sourceware.org> Date: Tue, 27 Jun 2023 12:07:40 +0000 (GMT) List-Id: https://gcc.gnu.org/g:125a2260ce07e384238f8569c77d07c56762d39c commit r14-2124-g125a2260ce07e384238f8569c77d07c56762d39c Author: Eric Botcazou Date: Mon Jun 12 12:36:56 2023 +0200 ada: Plug another loophole in the handling of private views in instances This deals with discriminants of types declared in package bodies. gcc/ada/ * sem_ch12.adb (Check_Private_View): Also check the type of visible discriminants in record and concurrent types. Diff: --- gcc/ada/sem_ch12.adb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index d5280cea712..fbfc2db7f9a 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -7710,6 +7710,9 @@ package body Sem_Ch12 is Prepend_Elmt (Typ, Exchanged_Views); Exchange_Declarations (Etype (Get_Associated_Node (N))); + -- Check that the available views of Typ match their respective flag. + -- Note that the type of a visible discriminant is never private. + else Check_Private_Type (Typ, Has_Private_View (N)); @@ -7720,6 +7723,20 @@ package body Sem_Ch12 is elsif Is_Array_Type (Typ) then Check_Private_Type (Component_Type (Typ), Has_Secondary_Private_View (N)); + + elsif (Is_Record_Type (Typ) or else Is_Concurrent_Type (Typ)) + and then Has_Discriminants (Typ) + then + declare + Disc : Entity_Id; + + begin + Disc := First_Discriminant (Typ); + while Present (Disc) loop + Check_Private_Type (Etype (Disc), False); + Next_Discriminant (Disc); + end loop; + end; end if; end if; end if;