* [COMMITTED] ada: Plug small loophole in finalization machinery
@ 2023-12-19 14:30 Marc Poulhiès
0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2023-12-19 14:30 UTC (permalink / raw)
To: gcc-patches; +Cc: Eric Botcazou
From: Eric Botcazou <ebotcazou@adacore.com>
The path in Expand_N_If_Expression implementing the special optimization for
an unidimensional array type and dependent expressions with static bounds
fails to call Process_Transients_In_Expression on their list of actions.
gcc/ada/
* exp_ch4.adb (Expand_N_If_Expression): Also add missing calls to
Process_Transients_In_Expression on the code path implementing the
special optimization for an unidimensional array type and
dependent expressions with static bounds.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/exp_ch4.adb | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 8f4cf0808dc..527ca16aac4 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -5912,6 +5912,14 @@ package body Exp_Ch4 is
and then not Generate_C_Code
and then not Unnest_Subprogram_Mode
then
+ -- When the "then" or "else" expressions involve controlled function
+ -- calls, generated temporaries are chained on the corresponding list
+ -- of actions. These temporaries need to be finalized after the if
+ -- expression is evaluated.
+
+ Process_Transients_In_Expression (N, Then_Actions (N));
+ Process_Transients_In_Expression (N, Else_Actions (N));
+
declare
Ityp : constant Entity_Id := Base_Type (Etype (First_Index (Typ)));
--
2.43.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-12-19 14:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-19 14:30 [COMMITTED] ada: Plug small loophole in finalization machinery Marc Poulhiès
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).