A slice range can be specified either by a subtype name, regular range,
or subtype indication with constraints. The compiler missed the last
case.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

        * sem_res.adb (Resolve_Slice): Handle range given as a subtype
        indication.
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -11360,7 +11360,11 @@ package body Sem_Res is
          Set_Parent (Dexpr, Parent (Drange));
          Set_Sloc   (Dexpr, Sloc   (Drange));
 
-      --  The discrete_range is a regular range. Resolve the bounds and remove
+      elsif Nkind (Drange) = N_Subtype_Indication then
+         Dexpr := Range_Expression (Constraint (Drange));
+
+      --  The discrete_range is a regular range (or a range attribute, which
+      --  will be resolved into a regular range). Resolve the bounds and remove
       --  their side effects.
 
       else


Reply via email to