From: Eric Botcazou <ebotca...@adacore.com>

Unlike RTE, RTU_Entity alone does not cause the unit to be loaded.

gcc/ada/ChangeLog:

        * exp_ch7.adb (Shift_Address_For_Descriptor): Add dummy variable
        to make sure that System_Storage_Elements is loaded.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/exp_ch7.adb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
index 9abdcc18a57..4d2b8348048 100644
--- a/gcc/ada/exp_ch7.adb
+++ b/gcc/ada/exp_ch7.adb
@@ -8868,7 +8868,9 @@ package body Exp_Ch7 is
       Typ    : Entity_Id;
       Op_Nam : Name_Id) return Node_Id
    is
-      Loc : constant Source_Ptr := Sloc (Addr);
+      Loc   : constant Source_Ptr := Sloc (Addr);
+      Dummy : constant Entity_Id  := RTE (RE_Storage_Offset);
+      --  Make sure System_Storage_Elements is loaded for RTU_Entity
 
    begin
       --  Generate:
-- 
2.43.0

Reply via email to