Skip to content

Commit 64883ac

Browse files
committed
Handle anonymous subtypes as constraints.
1 parent 591cb65 commit 64883ac

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

gnat2goto/driver/arrays.adb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,15 @@ package body Arrays is
392392
-- of the subtype have to be obtained - which should be a range.
393393
Bound_Range : constant Node_Id :=
394394
(if Nkind (Idx) = N_Range
395-
then Idx
396-
else Scalar_Range (Entity (Idx)));
395+
then
396+
-- It is a range
397+
Idx
398+
elsif Nkind (Idx) = N_Subtype_Indication then
399+
-- It is an anonymous subtype
400+
Scalar_Range (Etype (Idx))
401+
else
402+
-- It is an explicitly declared subtype
403+
Scalar_Range (Entity (Idx)));
397404

398405
Lbound : constant Irep :=
399406
Typecast_If_Necessary (Do_Expression (Low_Bound (Bound_Range)),

0 commit comments

Comments
 (0)