From patchwork Tue May 17 08:27:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 54076 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 479A83857427 for ; Tue, 17 May 2022 08:42:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 479A83857427 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1652776948; bh=imY35NJd1b2Q0r51Ia2uiv/jnQse283pd91Tpk6hh0c=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=eqBZQ/ARdteEiVtNQc3FxVWPCWloXqD18Gk602oY5b6zwd7/sqAIHHy+kHw8ghGmi 1hqdKmOdO9Jj1AAXQUpa8nJr26fjFVADcpCd+GXyPiTdgFKErkaoSMTScRmmvKlTux TPTX2d2ldA92ZKcFYr0L+BRfI+iztuMLjLmoH1Mc= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 To: gcc-patches@gcc.gnu.org Subject: [Ada] Take full view of private type Message-ID: <20220517082741.GA1089372@adacore.com> MIME-Version: 1.0 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-Patchwork-Original-From: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Cc: Etienne Servais Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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. 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