From: charlet Date: Mon, 4 Oct 2004 14:59:10 +0000 (+0000) Subject: 2004-10-04 Robert Dewar X-Git-Tag: upstream/4.9.2~67263 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eed46cf96d000673f9f2e9456e7ab4c626a17b32;p=platform%2Fupstream%2Flinaro-gcc.git 2004-10-04 Robert Dewar * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88501 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 043d3e1..50474d6 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,12 @@ 2004-10-04 Robert Dewar + * 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 + * exp_ch3.adb (Needs_Simple_Initialization): Modular packed arrays no longer need to be initialized to zero. (Get_Simple_Init_Val): Modular packed arrays no longer need to be diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 7f57b02..ac3c389 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -5987,9 +5987,16 @@ package body Exp_Ch4 is Ptp : Entity_Id := Etype (Pfx); function Is_Procedure_Actual (N : Node_Id) return Boolean; - -- Check whether context is a procedure call, in which case - -- expansion of a bit-packed slice is deferred until the call - -- itself is expanded. + -- Check whether the argument is an actual for a procedure call, + -- in which case the expansion of a bit-packed slice is deferred + -- 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; -- Create a named variable for the value of the slice, in @@ -6004,21 +6011,30 @@ package body Exp_Ch4 is Par : Node_Id := Parent (N); begin - while Present (Par) - and then Nkind (Par) not in N_Statement_Other_Than_Procedure_Call loop + -- If our parent is a procedure call we can return + if Nkind (Par) = N_Procedure_Call_Statement then return True; - elsif Nkind (Par) = N_Function_Call then - return False; + -- If our parent is a type conversion, keep climbing the + -- 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); + + -- Any other case is not what we are looking for + + else + return False; end if; end loop; - - return False; end Is_Procedure_Actual; --------------------