]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Fix another incorrectly nested procedure
authorMarc Poulhiès <poulhies@adacore.com>
Fri, 10 Oct 2025 08:52:47 +0000 (10:52 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 3 Nov 2025 14:15:17 +0000 (15:15 +0100)
commit2c77eeb8d823982c412fbc5f9aaeec7735cc7ed6
tree98ea4e468803b929b70110620633517f61b2e647
parente818a8e8bf0de77672386d5953cdb5bc3dc5a605
ada: Fix another incorrectly nested procedure

When unnesting a loop, its body is moved inside a procedure, and inner
entities have their scope adjusted. The current GNAT Tree at this stage
is incoherent wrt scope information, and some nested entities are
incorrectly scoped, possibly leading to a crash of the unnester.

The existing Fixup_Inner_Scopes procedure has been added to adjust the
incoherences after the fact because fixing them earlier has proven to be
more complex than expected. This change adds one more adjustment by this
procedure for TSS (Type Support Subprogram) that may be embedded within
N_Freeze_Entity nodes.

gcc/ada/ChangeLog:

* exp_ch7.adb (Fixup_Inner_Scopes): Adjust to handle N_Freeze_Entity nodes.
* exp_unst.adb (Get_Level): Assert when the function didn't find the
nested level (indicates that inner sub has scope pointing higher in
the stack)
gcc/ada/exp_ch7.adb
gcc/ada/exp_unst.adb