Commit c6a60aa1 by Robert Dewar Committed by Arnaud Charlet

exp_ch4.adb (Is_Procedure_Actual): Correct so that this does not consider…

exp_ch4.adb (Is_Procedure_Actual): Correct so that this does not consider expressions buried within a procedure...

2004-10-04  Robert Dewar  <dewar@gnat.com>

	* exp_ch4.adb (Is_Procedure_Actual): Correct so that this does not
	consider expressions buried within a procedure actual to be an actual.
	This caused some blowups with uses of packed slices within a procedure
	actual.

From-SVN: r88501
parent 1fdebfe5
2004-10-04 Robert Dewar <dewar@gnat.com> 2004-10-04 Robert Dewar <dewar@gnat.com>
* exp_ch4.adb (Is_Procedure_Actual): Correct so that this does not
consider expressions buried within a procedure actual to be an actual.
This caused some blowups with uses of packed slices within a procedure
actual.
2004-10-04 Robert Dewar <dewar@gnat.com>
* exp_ch3.adb (Needs_Simple_Initialization): Modular packed arrays no * exp_ch3.adb (Needs_Simple_Initialization): Modular packed arrays no
longer need to be initialized to zero. longer need to be initialized to zero.
(Get_Simple_Init_Val): Modular packed arrays no longer need to be (Get_Simple_Init_Val): Modular packed arrays no longer need to be
......
...@@ -5987,9 +5987,16 @@ package body Exp_Ch4 is ...@@ -5987,9 +5987,16 @@ package body Exp_Ch4 is
Ptp : Entity_Id := Etype (Pfx); Ptp : Entity_Id := Etype (Pfx);
function Is_Procedure_Actual (N : Node_Id) return Boolean; function Is_Procedure_Actual (N : Node_Id) return Boolean;
-- Check whether context is a procedure call, in which case -- Check whether the argument is an actual for a procedure call,
-- expansion of a bit-packed slice is deferred until the call -- in which case the expansion of a bit-packed slice is deferred
-- itself is expanded. -- until the call itself is expanded. The reason this is required
-- is that we might have an IN OUT or OUT parameter, and the copy out
-- is essential, and that copy out would be missed if we created a
-- temporary here in Expand_N_Slice. Note that we don't bother
-- to test specifically for an IN OUT or OUT mode parameter, since it
-- is a bit tricky to do, and it is harmless to defer expansion
-- in the IN case, since the call processing will still generate the
-- appropriate copy in operation, which will take care of the slice.
procedure Make_Temporary; procedure Make_Temporary;
-- Create a named variable for the value of the slice, in -- Create a named variable for the value of the slice, in
...@@ -6004,21 +6011,30 @@ package body Exp_Ch4 is ...@@ -6004,21 +6011,30 @@ package body Exp_Ch4 is
Par : Node_Id := Parent (N); Par : Node_Id := Parent (N);
begin begin
while Present (Par)
and then Nkind (Par) not in N_Statement_Other_Than_Procedure_Call
loop loop
-- If our parent is a procedure call we can return
if Nkind (Par) = N_Procedure_Call_Statement then if Nkind (Par) = N_Procedure_Call_Statement then
return True; return True;
elsif Nkind (Par) = N_Function_Call then -- If our parent is a type conversion, keep climbing the
return False; -- tree, since a type conversion can be a procedure actual.
-- Also keep climbing if parameter association or a qualified
-- expression, since these are additional cases that do can
-- appear on procedure actuals.
else elsif Nkind (Par) = N_Type_Conversion
or else Nkind (Par) = N_Parameter_Association
or else Nkind (Par) = N_Qualified_Expression
then
Par := Parent (Par); Par := Parent (Par);
-- Any other case is not what we are looking for
else
return False;
end if; end if;
end loop; end loop;
return False;
end Is_Procedure_Actual; end Is_Procedure_Actual;
-------------------- --------------------
......
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