ada: Fix fallout of recent fix for missing finalization
commit9dbf6adb3e0f849d0622a59b6c722f0d868e6c25
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 13 Apr 2023 21:11:38 +0000 (13 23:11 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 30 May 2023 07:12:16 +0000 (30 09:12 +0200)
tree7e17e2e62e25b5f46a0617ffd1b7355c2fb55610
parent9be806a5c671f9524a92cd610750bf8712bed149
ada: Fix fallout of recent fix for missing finalization

The original fix makes it possible to create transient scopes around return
statements in more cases, but it overlooks that transient scopes are reused
and, in particular, that they can be promoted to secondary stack management.

gcc/ada/

* exp_ch7.adb (Find_Enclosing_Transient_Scope): Return the index in
the scope table instead of the scope's entity.
(Establish_Transient_Scope): If an enclosing scope already exists,
do not set the Uses_Sec_Stack flag on it if the node to be wrapped
is a return statement which requires secondary stack management.
gcc/ada/exp_ch7.adb