]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Fix missing check on slice with a subtype indication
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 26 Aug 2021 15:35:27 +0000 (17:35 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 4 Oct 2021 08:45:06 +0000 (08:45 +0000)
gcc/ada/

* sem_res.adb (Resolve_Slice): Handle range given as a subtype
indication.

gcc/ada/sem_res.adb

index c493d5d34bac8b7478bf5a391e7ddf41679f2f49..ba733a504ca5d5c8fd7f2bb56cdfdbdaf436e781 100644 (file)
@@ -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