diff options
Diffstat (limited to 'src/vhdl')
-rw-r--r-- | src/vhdl/translate/trans-chap3.adb | 4 | ||||
-rw-r--r-- | src/vhdl/translate/trans-chap6.adb | 12 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/vhdl/translate/trans-chap3.adb b/src/vhdl/translate/trans-chap3.adb index 9291bd38b..f09601066 100644 --- a/src/vhdl/translate/trans-chap3.adb +++ b/src/vhdl/translate/trans-chap3.adb @@ -1180,6 +1180,10 @@ package body Trans.Chap3 is if Info.Type_Locally_Constrained then Arr := Arr_Def; else + -- If the element has been constrained, there is no ortho array + -- with the constrained element. So use the base type as a fall + -- back (if the element cannot be constrained, it is the same as the + -- base type element). Arr := Get_Base_Type (Arr_Def); end if; return Get_Element_Subtype (Arr); diff --git a/src/vhdl/translate/trans-chap6.adb b/src/vhdl/translate/trans-chap6.adb index 1e5fe6bc2..1f4edde79 100644 --- a/src/vhdl/translate/trans-chap6.adb +++ b/src/vhdl/translate/trans-chap6.adb @@ -558,15 +558,14 @@ package body Trans.Chap6 is -- Type of the first (and only) index of the prefix array type. Index_Type : constant Iir := Get_Index_Type (Prefix_Type, 0); - -- Element type. - El_Type : constant Iir := - Chap3.Get_Element_Subtype_For_Info (Prefix_Type); - El_Tinfo : constant Type_Info_Acc := Get_Info (El_Type); - -- Type of the slice. Slice_Type : constant Iir := Get_Type (Expr); Slice_Info : Type_Info_Acc; + -- Element type. + El_Type : Iir; + El_Tinfo : Type_Info_Acc; + -- Suffix of the slice (discrete range). Expr_Range : constant Iir := Get_Suffix (Expr); @@ -597,6 +596,9 @@ package body Trans.Chap6 is Prefix_Var := Prefix; + El_Type := Chap3.Get_Element_Subtype_For_Info (Slice_Type); + El_Tinfo := Get_Info (El_Type); + if Is_Unbounded_Type (El_Tinfo) then -- Copy layout of element before building the bounds -- pragma Assert (Is_Unbounded_Type (Prefix_Info)); |