diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2023-11-22 23:04:33 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-12-19 15:27:48 +0100 |
commit | 64a485df891c615b9a9744589c0a36beb38604b3 (patch) | |
tree | 6ce76519c71b7a56daa7d867cd2520663cf1589c /gcc | |
parent | 5c374c0907b4da06c163e3d15f182d91f1114ff2 (diff) | |
download | gcc-64a485df891c615b9a9744589c0a36beb38604b3.zip gcc-64a485df891c615b9a9744589c0a36beb38604b3.tar.gz gcc-64a485df891c615b9a9744589c0a36beb38604b3.tar.bz2 |
ada: Plug small loophole in finalization machinery
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/exp_ch4.adb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 8f4cf08..527ca16 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))); |