From patchwork Tue Jul 5 08:30:11 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: 1652361 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=bBNiJeUH; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LcblB5fQ6z9s1l for ; Tue, 5 Jul 2022 18:42:14 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A63C73942964 for ; Tue, 5 Jul 2022 08:42:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A63C73942964 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1657010532; bh=Fv9H5nKMTDJeJE7XZg9zHHD/r6lXH4jinNoT0IjyUJA=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=bBNiJeUHr0GoSUCsAHlLmUgZOfwhEJ5ZGBSqv8rc8CUKh9r2tN6cEWgcTNl5GuUU0 oQmLLmzn4Y2Yq3Xq6S9GwciZoS0ccLrwsH3NdjgJoU+71AeGXcZWQIe2zjM+HseqK4 gKTOpLiWyaAM5lR+3MXVjglcxhCwh+viuEUsGp28= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id 45CFA3858036 for ; Tue, 5 Jul 2022 08:30:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 45CFA3858036 Received: by mail-wm1-x334.google.com with SMTP id c131-20020a1c3589000000b003a19b2bce36so3666908wma.4 for ; Tue, 05 Jul 2022 01:30:13 -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=Fv9H5nKMTDJeJE7XZg9zHHD/r6lXH4jinNoT0IjyUJA=; b=Yzkps5h3HVrDi7KPpF7J/nwlpaOGVfrKU6VZ01Dzp5XbwCf00tRHEPDy1qoH85CtPM k16J6EupKUKcoi6a0+n1NobOdBpNFbuMzOGCEVvk3LsazcqezCHHVLNRDROlBXPWnGZu XloMdkJ3Wvcx0zolIoPhP1TxOmtbn6gh/WafXKd6Q7wHcMEYB8uZVxTgHzLkoilVPsgb Wlm16gRQX50fSLTydshprJHkEJjHlWMlBwTQ5YZMCs5GK0MoR0CVhHrIDeq8hK46Hp+S TDCvfTomhrf+QnsOC+KrvB33nWOTlFJG9qvSRjzE7PChFwpGsJ6LOZCBBzbc5wB00gtM qAvg== X-Gm-Message-State: AJIora8oCe5bAh1z5zCM5HSipgECpsUa7gQ1jqB/X5mzYfQ+vNzisMTm 3Rr3xc2eESrkwPwpSaVkNryNdoSqNv4SEg== X-Google-Smtp-Source: AGRyM1vT01WYZ2syINn9h20yOQuNYW3pgnG5SaztFc2BA2m1rezS5fZjNURIbX9d6vQ4tyllyEF4sA== X-Received: by 2002:a05:600c:19d0:b0:3a1:99b7:512 with SMTP id u16-20020a05600c19d000b003a199b70512mr14354075wmq.106.1657009812066; Tue, 05 Jul 2022 01:30:12 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id f7-20020a05600c4e8700b003a17ab4e7c8sm20956192wmq.39.2022.07.05.01.30.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Jul 2022 01:30:11 -0700 (PDT) Date: Tue, 5 Jul 2022 08:30:11 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Couple of small cleanups for Cloned_Subtype Message-ID: <20220705083011.GA3198649@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.3 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: Eric Botcazou Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" No functional changes. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_util.adb (Make_Subtype_From_Expr): Do not set field to Empty. * sem_util.adb (Visit_Itype): Remove ??? comment. diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -10213,8 +10213,8 @@ package body Exp_Util is elsif Is_Class_Wide_Type (Unc_Typ) then declare - CW_Subtype : Entity_Id; - EQ_Typ : Entity_Id := Empty; + CW_Subtype : constant Entity_Id := + New_Class_Wide_Subtype (Unc_Typ, E); begin -- A class-wide equivalent type is not needed on VM targets @@ -10237,11 +10237,10 @@ package body Exp_Util is Set_Etype (Unc_Typ, Base_Type (Full_View (Etype (Unc_Typ)))); end if; - EQ_Typ := Make_CW_Equivalent_Type (Unc_Typ, E); + Set_Equivalent_Type + (CW_Subtype, Make_CW_Equivalent_Type (Unc_Typ, E)); end if; - CW_Subtype := New_Class_Wide_Subtype (Unc_Typ, E); - Set_Equivalent_Type (CW_Subtype, EQ_Typ); Set_Cloned_Subtype (CW_Subtype, Base_Type (Unc_Typ)); return New_Occurrence_Of (CW_Subtype, Loc); diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -25146,8 +25146,7 @@ package body Sem_Util is end if; -- If a record subtype is simply copied, the entity list will be - -- shared. Thus cloned_Subtype must be set to indicate the sharing. - -- ??? What does this do? + -- shared, so Cloned_Subtype must be set to indicate this. if Ekind (Itype) in E_Class_Wide_Subtype | E_Record_Subtype then Set_Cloned_Subtype (New_Itype, Itype);