From: Justin Squirek Date: Thu, 19 Mar 2020 20:59:30 +0000 (-0400) Subject: [Ada] Missing accessibility error on object in type conversion X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=695a27fbb77c02fedb946c8c8349f108629bd45f;p=gcc.git [Ada] Missing accessibility error on object in type conversion 2020-06-12 Justin Squirek gcc/ada/ * sem_util.adb (Object_Access_Level): Add processing of implicit dereferences. --- diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 207d9d23ba1..3ae82645ffb 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -23697,12 +23697,23 @@ package body Sem_Util is -- Local variables E : Entity_Id; - Orig_Obj : constant Node_Id := Original_Node (Obj); + Orig_Obj : Node_Id := Original_Node (Obj); Orig_Pre : Node_Id; -- Start of processing for Object_Access_Level begin + -- In the case of an expanded implicit dereference we swap the original + -- object to be the expanded conversion. + + if Nkind (Obj) = N_Explicit_Dereference + and then Nkind (Orig_Obj) /= N_Explicit_Dereference + then + Orig_Obj := Obj; + end if; + + -- Calculate the object node's accessibility level + if Nkind (Orig_Obj) = N_Defining_Identifier or else Is_Entity_Name (Orig_Obj) then