From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id 194D5385741C for ; Tue, 17 May 2022 08:27:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 194D5385741C Received: by mail-wr1-x42b.google.com with SMTP id f2so16640765wrc.0 for ; Tue, 17 May 2022 01:27:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=imY35NJd1b2Q0r51Ia2uiv/jnQse283pd91Tpk6hh0c=; b=nlIIjkuGnOTCVzhrnW3GQFDtv31ppv/Rn5AsKFlYvUrRVMchgb/BxYvP1wRlfxYDYc gYQ60eCm+5tsLrSUMFVw41qhhMvp0joLIffEC9YQKGrLbiEZ6FxB7PeHk3Vl7CqR+vUn 4I+dxwJipg4fQfwBuLHI5Mqeo32AxIdZ2yXB5PprKKScjatpbSpuyz3EmVRsfqIc01kE Duwz8+/7cgVvklqLrLBVToZHA/YGbDS8ezr24Guc0ed3WTC5ZaulUPfW2uelJm4r1dSC jDQGsJ6BKCgaWdoBUH0C7FSlpqeS6Bl98kX2E8HS0BQh6g/N2w4wYTgkGgJMrC0vJMMc uPVA== X-Gm-Message-State: AOAM530S4yGsVKp44lHHgJ8YmN4JsoKDHbD5rxxnOqogdoV3JPQJwXW6 XxQhKZSMIJ1DExPcwWFavmVsz68rzQq/DTM1 X-Google-Smtp-Source: ABdhPJycV+mGyHv2gwGns+kGZnM9WjBdst+8Flm3xW3kYFrPHOX+5yU02bom93WZVFPDPv6BWTZPUA== X-Received: by 2002:adf:efcd:0:b0:20d:4b7:ef9c with SMTP id i13-20020adfefcd000000b0020d04b7ef9cmr9242781wrp.228.1652776062652; Tue, 17 May 2022 01:27:42 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id bd10-20020a05600c1f0a00b00394538d039esm1291682wmb.6.2022.05.17.01.27.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 01:27:42 -0700 (PDT) Date: Tue, 17 May 2022 08:27:41 +0000 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Etienne Servais Subject: [Ada] Take full view of private type Message-ID: <20220517082741.GA1089372@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Kj7319i9nmIyA2yE" Content-Disposition: inline X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 May 2022 08:27:44 -0000 --Kj7319i9nmIyA2yE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline This allows to resolve the following: type Rec (<>) is private; type Arr (<>) is private; private type Arr is array (Positive range <>) of Natural; type Rec (L : Natural) is record F1 : Integer; F2 : Arr (1 .. L); end record; Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch3.adb (Analyze_Subtype_Declaration): Use underlying type of Indic_Typ. (Constrain_Array): Ditto for T. --Kj7319i9nmIyA2yE Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -5978,7 +5978,7 @@ package body Sem_Ch3 is if Nkind (Subtype_Indication (N)) = N_Subtype_Indication then declare Indic_Typ : constant Entity_Id := - Etype (Subtype_Mark (Subtype_Indication (N))); + Underlying_Type (Etype (Subtype_Mark (Subtype_Indication (N)))); Subt_Index : Node_Id; Target_Index : Node_Id; @@ -13595,6 +13595,8 @@ package body Sem_Ch3 is T := Designated_Type (T); end if; + T := Underlying_Type (T); + -- If an index constraint follows a subtype mark in a subtype indication -- then the type or subtype denoted by the subtype mark must not already -- impose an index constraint. The subtype mark must denote either an --Kj7319i9nmIyA2yE--