diff options
| -rw-r--r-- | src/vhdl/translate/trans-chap3.adb | 15 | ||||
| -rw-r--r-- | src/vhdl/translate/trans-chap3.ads | 6 | ||||
| -rw-r--r-- | src/vhdl/translate/trans-chap6.adb | 8 | 
3 files changed, 25 insertions, 4 deletions
diff --git a/src/vhdl/translate/trans-chap3.adb b/src/vhdl/translate/trans-chap3.adb index 7f135a748..b036f4d5f 100644 --- a/src/vhdl/translate/trans-chap3.adb +++ b/src/vhdl/translate/trans-chap3.adb @@ -1172,6 +1172,19 @@ package body Trans.Chap3 is        Finish_Subprogram_Body;     end Create_Array_Type_Builder; +   function Get_Element_Subtype_For_Info (Arr_Def : Iir) return Iir +   is +      Info : constant Type_Info_Acc := Get_Info (Arr_Def); +      Arr : Iir; +   begin +      if Info.Type_Locally_Constrained then +         Arr := Arr_Def; +      else +         Arr := Get_Base_Type (Arr_Def); +      end if; +      return Get_Element_Subtype (Arr); +   end Get_Element_Subtype_For_Info; +     procedure Translate_Array_Subtype_Definition (Def : Iir)     is        Parent_Type : constant Iir := Get_Parent_Type (Def); @@ -3162,7 +3175,7 @@ package body Trans.Chap3 is       return Mnode     is        T_Info   : constant Type_Info_Acc := Get_Info (Atype); -      El_Type  : constant Iir := Get_Element_Subtype (Atype); +      El_Type  : constant Iir := Get_Element_Subtype_For_Info (Atype);        El_Tinfo : constant Type_Info_Acc := Get_Info (El_Type);        Kind     : constant Object_Kind_Type := Get_Object_Kind (Base);     begin diff --git a/src/vhdl/translate/trans-chap3.ads b/src/vhdl/translate/trans-chap3.ads index 672f5f7a2..92338bc93 100644 --- a/src/vhdl/translate/trans-chap3.ads +++ b/src/vhdl/translate/trans-chap3.ads @@ -307,6 +307,12 @@ package Trans.Chap3 is     procedure Translate_Array_Subtype (Arr_Type : Iir);     procedure Elab_Array_Subtype (Arr_Type : Iir); +   --  Return the element subtype to be used for getting type info. +   --  Follow the translation for array subtypes, as a type for the element is +   --  not created if the array is not also constrained with locally static +   --  indexes. +   function Get_Element_Subtype_For_Info (Arr_Def : Iir) return Iir; +     --  Create the bounds for SUB_TYPE.     --  SUB_TYPE is expected to be a non-static, anonymous array or record     --  subtype. diff --git a/src/vhdl/translate/trans-chap6.adb b/src/vhdl/translate/trans-chap6.adb index 64078a13d..1e5fe6bc2 100644 --- a/src/vhdl/translate/trans-chap6.adb +++ b/src/vhdl/translate/trans-chap6.adb @@ -559,7 +559,8 @@ package body Trans.Chap6 is        Index_Type : constant Iir := Get_Index_Type (Prefix_Type, 0);        --  Element type. -      El_Type    : constant Iir := Get_Element_Subtype (Prefix_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. @@ -598,7 +599,7 @@ package body Trans.Chap6 is        if Is_Unbounded_Type (El_Tinfo) then           --  Copy layout of element before building the bounds -         pragma Assert (Is_Unbounded_Type (Prefix_Info)); +--         pragma Assert (Is_Unbounded_Type (Prefix_Info));           Stabilize (Prefix_Var);           Gen_Memcpy             (M2Addr (Chap3.Array_Bounds_To_Element_Layout @@ -814,7 +815,8 @@ package body Trans.Chap6 is        Slice_Type  : constant Iir := Get_Type (Expr);        Slice_Tinfo : constant Type_Info_Acc := Get_Info (Slice_Type); -      El_Type  : constant Iir := Get_Element_Subtype (Slice_Type); +      El_Type  : constant Iir := +        Chap3.Get_Element_Subtype_For_Info (Slice_Type);        El_Tinfo : constant Type_Info_Acc := Get_Info (El_Type);        --  Object kind of the prefix.  | 
