]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Fix premature finalization for nested return within extended one
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 8 Nov 2023 22:29:01 +0000 (23:29 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 28 Nov 2023 09:35:47 +0000 (10:35 +0100)
commitf6bbf84ec759f203251c6c5a0dec8344f17cc614
tree9a4bc73fe32caa9a3655749261b68dedf5036823
parentd2f2b9e6f9bcc2398f7e9a5a42dfa55053bdb0bf
ada: Fix premature finalization for nested return within extended one

The return object is incorrectly finalized when the nested return is taken,
because the special flag attached to the return object is not updated.

gcc/ada/

* exp_ch6.adb (Build_Flag_For_Function): New function made up of the
code building the special flag for return object present...
(Expand_N_Extended_Return_Statement): ...in there.  Replace the code
with a call to Build_Flag_For_Function.  Add assertion for the flag.
(Expand_Non_Function_Return): For a nested return, if the return
object needs finalization actions, update the special flag.
gcc/ada/exp_ch6.adb