From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id E609F3851AA1 for ; Wed, 13 Jul 2022 10:03:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E609F3851AA1 Received: by mail-ej1-x630.google.com with SMTP id ez10so18913290ejc.13 for ; Wed, 13 Jul 2022 03:03:06 -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=3zfsjiv/UqFEG7mxOmqEB+o+0edbr8+YCbs5Z0kFuAM=; b=tts8ixvv7rLdmVthBMEat0q5LfIe0lAy4bw1Ty0nmFU7LYPOb4slmcfn44wSf0Ok3l 7gelX9TTupUcIvyZO6xXooCVgy9o67eovHXTc0Gu3/STsmv6X0GyaGrdWwOQLUBOdsxy 4ecybagiFHkcpLiPnuuP7bd5vgotuPH3tfCInYQrt+RER0q9ggI0gAa7Psz+YW11IJd/ XaznXKvsWcvUl3OvJyGB/+Bf26pvuHFoff44aza3l93tZRpGXEH+gqhsOMrmtDfLVHE8 9ZBEnjB7Lq6hFqcZ08i+84TBQkXI1pMPTVrGKMkUxXYxiDl3W6c+HoDejSrEuu3msIbL 6oLw== X-Gm-Message-State: AJIora9BGxGPW38z88HmM5QCNE0m+InbrCLfBziWVTdd6OUN5G5rd5Oc fJnP+gCN8OBTxT2G2PGp/ueW0ZKDUlE3Pw== X-Google-Smtp-Source: AGRyM1s+J9wqgXv+p/SwbMQVBpTljNeSSVfTZcVLyTpF1qUPbvRq1JXZyM1fcXN8HFQFfNoP9/D8uw== X-Received: by 2002:a17:907:628a:b0:6fe:526c:ebc with SMTP id nd10-20020a170907628a00b006fe526c0ebcmr2431832ejc.531.1657706585744; Wed, 13 Jul 2022 03:03:05 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id v18-20020a170906293200b006fe8ec44461sm4773168ejd.101.2022.07.13.03.03.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 03:03:05 -0700 (PDT) Date: Wed, 13 Jul 2022 10:03:04 +0000 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [Ada] Generate debug info entry for user-defined access subtype Message-ID: <20220713100304.GA994799@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="qMm9M+Fa2AknHoGS" 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: Wed, 13 Jul 2022 10:03:08 -0000 --qMm9M+Fa2AknHoGS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline This is consistent with the other kinds of subtypes. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) : Do not reuse the TYPE_DECL of the base type. --qMm9M+Fa2AknHoGS Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -3867,7 +3867,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) case E_Access_Subtype: /* We treat this as identical to its base type; any constraint is meaningful only to the front-end. */ - gnu_decl = gnat_to_gnu_entity (gnat_equiv_type, NULL_TREE, false); + gnu_type = gnat_to_gnu_type (gnat_equiv_type); maybe_present = true; /* The designated subtype must be elaborated as well, if it does @@ -3877,11 +3877,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) && Is_Frozen (Directly_Designated_Type (gnat_entity)) && No (Freeze_Node (Directly_Designated_Type (gnat_entity)))) { - tree gnu_base_type = TREE_TYPE (gnu_decl); - tree gnu_desig_base_type - = TYPE_IS_FAT_POINTER_P (gnu_base_type) - ? TREE_TYPE (TREE_TYPE (TYPE_FIELDS (gnu_base_type))) - : TREE_TYPE (gnu_base_type); + tree gnu_desig_type + = TYPE_IS_FAT_POINTER_P (gnu_type) + ? TREE_TYPE (TREE_TYPE (TYPE_FIELDS (gnu_type))) + : TREE_TYPE (gnu_type); /* If we are to defer elaborating incomplete types, make a dummy type node and elaborate it later. */ @@ -3898,7 +3897,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) /* Otherwise elaborate the designated subtype only if its base type has already been elaborated. */ - else if (!TYPE_IS_DUMMY_P (gnu_desig_base_type)) + else if (!TYPE_IS_DUMMY_P (gnu_desig_type)) gnat_to_gnu_entity (Directly_Designated_Type (gnat_entity), NULL_TREE, false); } --qMm9M+Fa2AknHoGS--