https://gcc.gnu.org/g:811bfc3f3e4f6f3e7a98e90409a8a6dbaa1509e1
commit r15-591-g811bfc3f3e4f6f3e7a98e90409a8a6dbaa1509e1 Author: Viljar Indus <in...@adacore.com> Date: Tue Mar 5 11:57:12 2024 +0200 ada: Check subtype to avoid a precondition failure gcc/ada/ * sem_ch3.adb (Analyze_Component_Declaration): Apply range checks only for Scalar_Types to ensure that they have the Scalar_Range attribute. Diff: --- gcc/ada/sem_ch3.adb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 7ee4ca299d9d..263be607ec14 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -2029,8 +2029,9 @@ package body Sem_Ch3 is while Present (Target_Index) loop if Nkind (Subt_Index) in N_Expanded_Name | N_Identifier - and then Nkind - (Scalar_Range (Entity (Subt_Index))) = N_Range + and then Is_Scalar_Type (Entity (Subt_Index)) + and then + Nkind (Scalar_Range (Entity (Subt_Index))) = N_Range then Apply_Range_Check (Expr => Scalar_Range (Entity (Subt_Index)),