]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix regression under GNATProve mode
authorJavier Miranda <miranda@adacore.com>
Wed, 25 Feb 2026 14:24:02 +0000 (14:24 +0000)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 28 May 2026 08:52:48 +0000 (10:52 +0200)
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.

gcc/ada/sem_res.adb

index 33148e935a26a6b8fd65963a8bf69f28bddfb48f..9a9ae4bc4ca2838b40d7383808321a486289b154 100644 (file)
@@ -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