[COMMITTED] ada: Accept parameters of enclosing subprograms in exceptional cases

Message ID 20230529082923.2410140-1-poulhies@adacore.com
State Committed
Commit 4017d7fddda521dda5f0bc2c89942246d0aeedab
Headers
Series [COMMITTED] ada: Accept parameters of enclosing subprograms in exceptional cases |

Commit Message

Marc Poulhiès May 29, 2023, 8:29 a.m. UTC
  From: Piotr Trojanek <trojanek@adacore.com>

Rules about parameters of modes OUT and IN OUT in aspect
Exceptional_Cases only apply to the parameters of the current
subprogram.

gcc/ada/

	* sem_res.adb (Resolve_Entity_Name): Refine rules for Exceptional_Cases.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/sem_res.adb | 1 +
 1 file changed, 1 insertion(+)
  

Patch

diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 6d4bef8d38e..066072a6afe 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -8122,6 +8122,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 Within_Exceptional_Cases_Consequence (N)
               and then not In_Attribute_Old (N)
               and then not (Nkind (Parent (N)) = N_Attribute_Reference