From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id 5E76E3955632 for ; Thu, 2 Jun 2022 09:09:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5E76E3955632 Received: by mail-ej1-x62e.google.com with SMTP id u12so8701709eja.8 for ; Thu, 02 Jun 2022 02:09:16 -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=ua3ojleZ09UIN3IkamIaUwnQha+Rk1WmD8eL3KuiRFs=; b=ZUTuFV5IVihJSsq3OUFnutKbXwcI6O6ggoVOnMZYd3vdt+Ie2ATyZSuiruNjDbDnJ/ yqq20dLrWEwY2cUqpr/3j4Y3suAg1ARcrgdgvjFUl5ZlNZFKBicwlAYz5LvuSiTabEuT panwDd1cuIFgxJ8jiEk3gPAa3f+hGWYwZBqYpeUQHtDWmXONFx7+0yrukZpA8PEWvzYP 7EQ2GpL64AWYgw1qqb/JL/UZTE/4SX0e9hIxHHRQXPeadJKcRGGK9a7MiqxFgxlejwU0 BQ+ASNbRo7aAPe3Ol24B0Y7R1cbrC2KzrIxXrLa3XSW0/UJmkPxkYBxKPZTb6f/9RlHI btyQ== X-Gm-Message-State: AOAM531/M2+oCZmMA6hnip20QCI3qh4PGPp8Im+jxG0b1aZbmnyPkYw9 Ih4tGizPf0AsYenR2FhbuCg6a5a8j6Digg== X-Google-Smtp-Source: ABdhPJz9orCR9YI6+aVGSPV/M8w1KdRVHKJNqhZtIf/+iw2U2K1+wtyYe7zvjaqBMXHrXTrjptekBQ== X-Received: by 2002:a17:907:3f9f:b0:6fe:f9e2:9c6a with SMTP id hr31-20020a1709073f9f00b006fef9e29c6amr3370854ejc.479.1654160955915; Thu, 02 Jun 2022 02:09:15 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id m9-20020a170906580900b006feb7b1379dsm1479545ejq.181.2022.06.02.02.09.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jun 2022 02:09:15 -0700 (PDT) Date: Thu, 2 Jun 2022 09:09:14 +0000 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [Ada] Couple of small preparatory adjustments Message-ID: <20220602090914.GA1011008@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="HlL+5n6rz5pIUxbD" 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: Thu, 02 Jun 2022 09:09:17 -0000 --HlL+5n6rz5pIUxbD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline No functional changes. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity): Do not check the scope of anonymous access Itypes. * gcc-interface/trans.cc (Identifier_to_gnu): Do not translate the return type of a subprogram here. --HlL+5n6rz5pIUxbD 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 @@ -346,10 +346,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) && !present_gnu_tree (gnat_entity) && In_Extended_Main_Code_Unit (gnat_entity)) { - /* Ensure that we are in a subprogram mentioned in the Scope chain of + /* Unless it's for an anonymous access type, whose scope is irrelevant, + ensure that we are in a subprogram mentioned in the Scope chain of this entity, our current scope is global, or we encountered a task or entry (where we can't currently accurately check scoping). */ - if (!current_function_decl + if (Ekind (gnat_entity) == E_Anonymous_Access_Type + || !current_function_decl || DECL_ELABORATION_PROC_P (current_function_decl)) { process_type (gnat_entity); diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc --- a/gcc/ada/gcc-interface/trans.cc +++ b/gcc/ada/gcc-interface/trans.cc @@ -1220,10 +1220,13 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) gnat_result_type = Etype (gnat_node); } - /* Expand the type of this identifier first, in case it is an enumeral - literal, which only get made when the type is expanded. There is no - order-of-elaboration issue here. */ - gnu_result_type = get_unpadded_type (gnat_result_type); + /* Expand the type of this identifier first if it is needed, in case it is an + enumeral literal, which only get made when the type is expanded. There is + no order-of-elaboration issue here. */ + if (Is_Subprogram (gnat_entity)) + gnu_result_type = NULL_TREE; + else + gnu_result_type = get_unpadded_type (gnat_result_type); /* If this is a non-imported elementary constant with an address clause, retrieve the value instead of a pointer to be dereferenced unless --HlL+5n6rz5pIUxbD--