aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/trans.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/gcc-interface/trans.c')
-rw-r--r--gcc/ada/gcc-interface/trans.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 930725b..7b319d4 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -6084,10 +6084,18 @@ gnat_to_gnu (Node_Id gnat_node)
gnat_temp = Defining_Entity (gnat_node);
gnu_result = alloc_stmt_list ();
- /* Don't do anything if this renaming is handled by the front end or if
- we are just annotating types and this object has a composite or task
- type, don't elaborate it. */
- if (!Is_Renaming_Of_Object (gnat_temp)
+ /* Don't do anything if this renaming is handled by the front end and it
+ does not need debug info. Note that we consider renamings don't need
+ debug info when optimizing: our way to describe them has a
+ memory/elaboration footprint.
+
+ Don't do anything neither if we are just annotating types and this
+ object has a composite or task type, don't elaborate it. */
+ if ((!Is_Renaming_Of_Object (gnat_temp)
+ || (Needs_Debug_Info (gnat_temp)
+ && !optimize
+ && can_materialize_object_renaming_p
+ (Renamed_Object (gnat_temp))))
&& ! (type_annotate_only
&& (Is_Array_Type (Etype (gnat_temp))
|| Is_Record_Type (Etype (gnat_temp))