diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-04 14:59:10 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-04 14:59:10 +0000 |
commit | eed46cf96d000673f9f2e9456e7ab4c626a17b32 (patch) | |
tree | d871e190b881629be4ecf7da2c58a2a23ed58de4 /gcc/ada/exp_ch4.adb | |
parent | fa814356abcaab059cdffab069344e383ae45e71 (diff) | |
download | gcc-eed46cf96d000673f9f2e9456e7ab4c626a17b32.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88501 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_ch4.adb')
-rw-r--r-- | gcc/ada/exp_ch4.adb | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 7f57b02425c..ac3c3894585 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; -------------------- |