[Ada] Refine use of access types in unnesting

gcc/ada/

	* exp_unst.adb (Needs_Fat_Pointer): Don't check for formal.
	(Unnest_Subprogram): Use 'Unchecked_Access instead of 'Access
	when populating activation record.
This commit is contained in:
Richard Kenner 2020-05-04 09:47:30 -04:00 committed by Pierre-Marie de Rodat
parent f5b65fab88
commit 3e6bb105d3

View File

@ -251,18 +251,14 @@ package body Exp_Unst is
-----------------------
function Needs_Fat_Pointer (E : Entity_Id) return Boolean is
Typ : Entity_Id;
Typ : Entity_Id := Etype (E);
begin
if Is_Formal (E) then
Typ := Etype (E);
if Is_Private_Type (Typ) and then Present (Full_View (Typ)) then
Typ := Full_View (Typ);
end if;
return Is_Array_Type (Typ) and then not Is_Constrained (Typ);
else
return False;
end if;
end Needs_Fat_Pointer;
----------------
@ -2084,7 +2080,7 @@ package body Exp_Unst is
-- or else 'Access for unconstrained array
if Needs_Fat_Pointer (Ent) then
Attr := Name_Access;
Attr := Name_Unchecked_Access;
else
Attr := Name_Address;
end if;