public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-955] [Ada] Couple of small preparatory adjustments
@ 2022-06-02  9:10 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-06-02  9:10 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:59a6274d86824e9aadf8814c6fb9929ef5e423fc

commit r13-955-g59a6274d86824e9aadf8814c6fb9929ef5e423fc
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Tue Apr 19 21:53:35 2022 +0200

    [Ada] Couple of small preparatory adjustments
    
    No functional changes.
    
    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.

Diff:
---
 gcc/ada/gcc-interface/decl.cc  |  6 ++++--
 gcc/ada/gcc-interface/trans.cc | 11 +++++++----
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc
index bbbb343180d..9574dbbb396 100644
--- 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
index 8097a89b5ed..46030d808f5 100644
--- 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-02  9:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-02  9:10 [gcc r13-955] [Ada] Couple of small preparatory adjustments Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).