]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix for quantified expressions in Exceptional_Cases
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 1 Jun 2023 07:59:40 +0000 (09:59 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 20 Jun 2023 07:30:49 +0000 (09:30 +0200)
When detecting illegal uses of formal parameters of the current
subprogram in contract of its Exceptional_Cases, we relied on the
Current_Scope. However, quantified expressions introduce an implicit
scope, which we need to take into account.

gcc/ada/

* sem_res.adb (Resolve_Entity_Name): Ignore implicit loop scopes
introduced by quantified expressions.

gcc/ada/sem_res.adb

index 266cf8e559e5c7f18df167926bee02ce9f3fefa7..6867c8f1275e449cbec60bc82614e3e165a4e570 100644 (file)
@@ -8116,7 +8116,7 @@ package body Sem_Res is
             --  data from the object.
 
             if Ekind (E) in E_Out_Parameter | E_In_Out_Parameter
-              and then Scope (E) = Current_Scope
+              and then Scope (E) = Current_Scope_No_Loops
               and then Within_Exceptional_Cases_Consequence (N)
               and then not In_Attribute_Old (N)
               and then not (Nkind (Parent (N)) = N_Attribute_Reference