https://gcc.gnu.org/g:f1b1461173527b57cb9202e83cb7e0923d125a31

commit r17-781-gf1b1461173527b57cb9202e83cb7e0923d125a31
Author: Viljar Indus <[email protected]>
Date:   Wed Feb 4 14:42:22 2026 +0200

    ada: Normalize the handling of assertion policies
    
    Normalize On and Off to Check and Ignore policies in order to avoid
    internal logic errors.
    
    gcc/ada/ChangeLog:
    
            * sem_util.adb (Policy_In_Effect): Normalize the policy names.

Diff:
---
 gcc/ada/sem_util.adb | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 77a3dbec80f2..31a64ea4b120 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -27098,6 +27098,14 @@ package body Sem_Util is
          Kind := Policy_In_List (Check_Policy_List_Config);
       end if;
 
+      --  Normalize the policy names
+
+      if Kind = Name_Off then
+         Kind := Name_Ignore;
+      elsif Kind = Name_On then
+         Kind := Name_Check;
+      end if;
+
       --  The context lacks policy pragmas, determine the mode based on whether
       --  assertions are enabled at the configuration level. This ensures that
       --  the policy is preserved when analyzing generics.

Reply via email to