diff options
author | Ed Schonberg <schonberg@adacore.com> | 2008-05-20 14:52:41 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2008-05-20 14:52:41 +0200 |
commit | 590760eb9d222ed4b15e77bf6b53aec2827d0cdf (patch) | |
tree | 551b97e2d602d2b3be01024eb815c4dd3bea233e | |
parent | f5dac0d772d88d78496319189d9578be5c0f486e (diff) | |
download | gcc-590760eb9d222ed4b15e77bf6b53aec2827d0cdf.zip gcc-590760eb9d222ed4b15e77bf6b53aec2827d0cdf.tar.gz gcc-590760eb9d222ed4b15e77bf6b53aec2827d0cdf.tar.bz2 |
2008-05-20 Ed Schonberg <schonberg@adacore.com>
* exp_ch7.adb
(Expand_Ctrl_Function_Call): Do not attach result to finalization list
if expression is aggregate component.
From-SVN: r135650
-rw-r--r-- | gcc/ada/exp_ch7.adb | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index 916f7af..0140c76 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -1471,6 +1471,17 @@ package body Exp_Ch7 is -- Attach_To_Final_List (_Lx, Resx (Resx'last)._controller, 3); + -- If the context is an aggregate, the call will be expanded into an + -- assignment, and the attachment will be done when the aggregate + -- expansion is complete. See body of Exp_Aggr for the treatment of + -- other controlled components. + + if Nkind (Parent (N)) = N_Aggregate then + return; + end if; + + -- Case where type has controlled components + if Has_Controlled_Component (Rtype) then declare T1 : Entity_Id := Rtype; @@ -1536,15 +1547,14 @@ package body Exp_Ch7 is With_Attach => Make_Integer_Literal (Loc, Attach_Level)); end if; - else - -- Here, we have a controlled type that does not seem to have - -- controlled components but it could be a class wide type whose - -- further derivations have controlled components. So we don't know - -- if the object itself needs to be attached or if it - -- has a record controller. We need to call a runtime function - -- (Deep_Tag_Attach) which knows what to do thanks to the - -- RC_Offset in the dispatch table. + -- Here, we have a controlled type that does not seem to have + -- controlled components but it could be a class wide type whose + -- further derivations have controlled components. So we don't know + -- if the object itself needs to be attached or if it has a record + -- controller. We need to call a runtime function (Deep_Tag_Attach) + -- which knows what to do thanks to the RC_Offset in the dispatch table. + else Action := Make_Procedure_Call_Statement (Loc, Name => New_Reference_To (RTE (RE_Deep_Tag_Attach), Loc), |