From a9fb2055f3a7a05e493bbb614aca5ed3a19b80d2 Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Thu, 16 Apr 2020 13:59:53 +0200 Subject: [PATCH] [Ada] Fix failed assertion on a slice indexed by a subtype_indication 2020-06-18 Piotr Trojanek gcc/ada/ * checks.adb (Generate_Index_Checks): Handle N_Subtype_Indication returned from Scalar_Range. --- gcc/ada/checks.adb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index 51b73f992a6..7b8ca979a7e 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -6842,6 +6842,10 @@ package body Checks is elsif Nkind_In (A_Idx, N_Identifier, N_Expanded_Name) then A_Range := Scalar_Range (Entity (A_Idx)); + if Nkind (A_Range) = N_Subtype_Indication then + A_Range := Range_Expression (Constraint (A_Range)); + end if; + else pragma Assert (Nkind (A_Idx) = N_Subtype_Indication); A_Range := Range_Expression (Constraint (A_Idx)); end if; -- 2.30.2