Commit ebd01830 by Robert Dewar Committed by Arnaud Charlet

2008-05-28 Robert Dewar <dewar@adacore.com>

	* exp_ch5.adb:
	(Expand_Simple_Function_Return): Copy unaligned result into temporary

From-SVN: r136080
parent 63bdc3ea
......@@ -4032,6 +4032,28 @@ package body Exp_Ch5 is
end;
end if;
-- If we are returning an object that may not be bit-aligned, then
-- copy the value into a temporary first. This copy may need to expand
-- to a loop of component operations..
if Is_Possibly_Unaligned_Slice (Exp)
or else Is_Possibly_Unaligned_Object (Exp)
then
declare
Tnn : constant Entity_Id :=
Make_Defining_Identifier (Loc, New_Internal_Name ('T'));
begin
Insert_Action (Exp,
Make_Object_Declaration (Loc,
Defining_Identifier => Tnn,
Constant_Present => True,
Object_Definition => New_Occurrence_Of (R_Type, Loc),
Expression => Relocate_Node (Exp)),
Suppress => All_Checks);
Rewrite (Exp, New_Occurrence_Of (Tnn, Loc));
end;
end if;
-- Generate call to postcondition checks if they are present
if Ekind (Scope_Id) = E_Function
......@@ -4061,8 +4083,7 @@ package body Exp_Ch5 is
else
declare
Tnn : constant Entity_Id :=
Make_Defining_Identifier (Loc,
New_Internal_Name ('T'));
Make_Defining_Identifier (Loc, New_Internal_Name ('T'));
begin
-- For a complex expression of an elementary type, capture
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment