https://gcc.gnu.org/g:bee29e7e2a883f6831b24b5290b5e7067a26981b
commit r17-1361-gbee29e7e2a883f6831b24b5290b5e7067a26981b 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 962a2230cc80..a1d421898df8 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -4423,6 +4423,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;
