]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Fix spurious use of trampolines with interface types
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 18 May 2022 09:05:33 +0000 (11:05 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 2 Jun 2022 09:06:43 +0000 (09:06 +0000)
Function pointers must always be built with '[Unrestricted_]Access.

gcc/ada/

* exp_ch3.adb (Init_Secondary_Tags.Initialize_Tag): Initialize the
Offset_Func component by means of 'Unrestricted_Access.

gcc/ada/exp_ch3.adb

index 2f74208c40114fea412cc7bf12ae708bbf8027de..d02a863045b666e45d10c0cc7cc1dae22bf6c92c 100644 (file)
@@ -9506,7 +9506,7 @@ package body Exp_Ch3 is
             --       Prim_T       => Typ'Tag,
             --       Interface_T  => Iface'Tag,
             --       Offset_Value => n,
-            --       Offset_Func  => Fn'Address)
+            --       Offset_Func  => Fn'Unrestricted_Access)
 
             Append_To (Stmts_List,
               Make_Procedure_Call_Statement (Loc,
@@ -9541,7 +9541,7 @@ package body Exp_Ch3 is
                     Make_Attribute_Reference (Loc,
                       Prefix => New_Occurrence_Of
                                   (DT_Offset_To_Top_Func (Tag_Comp), Loc),
-                      Attribute_Name => Name_Address)))));
+                      Attribute_Name => Name_Unrestricted_Access)))));
 
             --  In this case the next component stores the value of the offset
             --  to the top.