]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix copying of quantified expressions
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 8 Mar 2023 14:30:41 +0000 (15:30 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 25 May 2023 07:44:18 +0000 (09:44 +0200)
While visiting the AST as part of routine New_Copy_Tree we maintain
an EWA_Level variable in a stack-like fashion. This worked fine for
expression with actions nodes but not for quantified expressions.

gcc/ada/

* sem_util.adb (Visit_Node): Decrement EWA_Level with the same condition
as when it was incremented.

gcc/ada/sem_util.adb

index b83c75939c734b19af7fab8c01193f97c9c61c7e..c9aa76707a5bf84b11a48dc00be57c611e7f70ff 100644 (file)
@@ -24383,7 +24383,10 @@ package body Sem_Util is
          then
             EWA_Inner_Scope_Level := EWA_Inner_Scope_Level - 1;
 
-         elsif Nkind (N) = N_Expression_With_Actions then
+         elsif Nkind (N) = N_Expression_With_Actions
+           or else
+             (Nkind (N) = N_Quantified_Expression and then Expander_Active)
+         then
             EWA_Level := EWA_Level - 1;
          end if;
       end Visit_Node;