aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch2.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/exp_ch2.adb')
-rw-r--r--gcc/ada/exp_ch2.adb8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/ada/exp_ch2.adb b/gcc/ada/exp_ch2.adb
index 612a461..d2f3df8 100644
--- a/gcc/ada/exp_ch2.adb
+++ b/gcc/ada/exp_ch2.adb
@@ -706,9 +706,15 @@ package body Exp_Ch2 is
T : constant Entity_Id := Etype (N);
begin
+ -- Mark the entity as referenced since this reference is going away
+
+ Set_Referenced (E);
+
+ -- Now rewrite the reference as a copy of the renamed object
+
Rewrite (N, New_Copy_Tree (Renamed_Object (E)));
- -- We mark the copy as unanalyzed, so that it is sure to be reanalyzed
+ -- Mark the copy as unanalyzed to make sure that it is reanalyzed
-- at the top level. This is needed in the packed case since we
-- specifically avoided expanding packed array references when the
-- renaming declaration was analyzed.