https://gcc.gnu.org/g:68ef7fc278755d2ca4d626c941000fa7a5e3dce3
commit r17-871-g68ef7fc278755d2ca4d626c941000fa7a5e3dce3 Author: Javier Miranda <[email protected]> Date: Wed Feb 25 14:24:02 2026 +0000 ada: Fix regression under GNATProve mode Improve previous patch since the regression reproduces also compiling under check syntax and semantic only mode (-gnatc). gcc/ada/ChangeLog: * sem_res.adb (Resolve_Declare_Expression): Do not create a transient scope when expansion is disabled. Diff: --- gcc/ada/sem_res.adb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 33148e935a26..9a9ae4bc4ca2 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -7774,8 +7774,7 @@ package body Sem_Res is -- Given that we don't know yet if secondary stack management will -- be needed, we assume the worst case. - if not Preanalysis_Active - and then not GNATprove_Mode + if Expander_Active and then (Requires_Transient_Scope (Typ) or else Has_Sec_Stack_Call (Expr)) then
