https://gcc.gnu.org/g:8f47c4bd05ebe1db724f08d7358c5acfff22cb9a

commit r16-9066-g8f47c4bd05ebe1db724f08d7358c5acfff22cb9a
Author: Viljar Indus <[email protected]>
Date:   Mon May 25 14:29:56 2026 +0300

    ada: Avoid suspicious index warnings in expanded code
    
    Some expansions and optimizations wrap the existing code in
    functions that loose the range constraints of the original
    variable. We should avoid triggering bogus errors in such scenarios.
    
    gcc/ada/ChangeLog:
    
            * sem_warn.adb (Warn_On_Suspicious_Index): Only check elements
            that are coming from source.

Diff:
---
 gcc/ada/sem_warn.adb | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index 654c6222e38b..55788e8db94c 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -4422,6 +4422,7 @@ package body Sem_Warn is
             if Is_Formal (Ent)
               and then Is_Suspicious_Type (Typ)
               and then not Low_Bound_Tested (Ent)
+              and then Comes_From_Source (Ent)
             then
                Test_Suspicious_Index;
             end if;

Reply via email to