diff options
Diffstat (limited to 'gcc/ada/exp_disp.adb')
-rw-r--r-- | gcc/ada/exp_disp.adb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb index 99105e0..905311b 100644 --- a/gcc/ada/exp_disp.adb +++ b/gcc/ada/exp_disp.adb @@ -1138,6 +1138,25 @@ package body Exp_Disp is Operand_Typ := Base_Type (Corresponding_Record_Type (Operand_Typ)); end if; + -- No displacement of the pointer to the object needed when the type of + -- the operand is not an interface type and the interface is one of + -- its parent types (since they share the primary dispatch table). + + declare + Opnd : Entity_Id := Operand_Typ; + + begin + if Is_Access_Type (Opnd) then + Opnd := Designated_Type (Opnd); + end if; + + if not Is_Interface (Opnd) + and then Is_Ancestor (Iface_Typ, Opnd, Use_Full_View => True) + then + return; + end if; + end; + -- Evaluate if we can statically displace the pointer to the object declare |