From: Javier Miranda <[email protected]>
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.
Tested on x86_64-pc-linux-gnu, committed on master.
---
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 33148e935a2..9a9ae4bc4ca 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
--
2.53.0