ada: Fix loop unnesting issue.
authorMarc Poulhiès <poulhies@adacore.com>
Thu, 22 Sep 2022 08:59:42 +0000 (10:59 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Fri, 4 Nov 2022 13:47:28 +0000 (14:47 +0100)
commit12cfb2949754facc3624d70f6267a10b8b57df88
tree628af522162df0c6e43a274128be9df1cb096592
parent73d04a073b7288fcf6fc2e1f25d8b1f3a2c6fb81
ada: Fix loop unnesting issue.

During loop unnesting, when the loop statements are wrapped in a code
block, the newly created block's scope must be set to the loop
scope (instead of the previous 'Current_Scope' that would point to an
upper scope).

gcc/ada/

* sem_util.ads (Add_Block_Identifier): Add new extra Scope
argument.
* sem_util.adb (Add_Block_Identifier): Likewise and use this scope
variable instead of Current_Scope.
* exp_util.adb (Wrap_Statements_In_Block): Add new scope argument
to Add_Block_Identifier call.
gcc/ada/exp_util.adb
gcc/ada/sem_util.adb
gcc/ada/sem_util.ads