diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-01-04 17:52:47 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-01-06 18:20:27 +0100 |
commit | 727f3514973a5ec8b7fc86bd8db6611585bd9217 (patch) | |
tree | df8a43e84add4956b2162b602d75860b8483a2f6 /src/vhdl | |
parent | 9b1191a6c717ae033a6bb8558e444ac1083d8100 (diff) | |
download | ghdl-727f3514973a5ec8b7fc86bd8db6611585bd9217.tar.gz ghdl-727f3514973a5ec8b7fc86bd8db6611585bd9217.tar.bz2 ghdl-727f3514973a5ec8b7fc86bd8db6611585bd9217.zip |
vhdl/translate: handle more partially constrained array subtypes. For #1038
Diffstat (limited to 'src/vhdl')
-rw-r--r-- | src/vhdl/translate/trans-chap3.adb | 3 | ||||
-rw-r--r-- | src/vhdl/translate/trans-chap6.adb | 7 | ||||
-rw-r--r-- | src/vhdl/translate/trans-rtis.adb | 6 |
3 files changed, 10 insertions, 6 deletions
diff --git a/src/vhdl/translate/trans-chap3.adb b/src/vhdl/translate/trans-chap3.adb index c09203252..64e658629 100644 --- a/src/vhdl/translate/trans-chap3.adb +++ b/src/vhdl/translate/trans-chap3.adb @@ -950,6 +950,9 @@ package body Trans.Chap3 is -- Declare the types. Finish_Unbounded_Type_Base (Info); else + -- The element type is not static (like an array sub-type with + -- bounds that were computed). So an array cannot be created in + -- ortho. if El_Tinfo.Type_Mode in Type_Mode_Arrays then Info.B.Base_Type := El_Tinfo.B.Base_Ptr_Type; Info.B.Base_Ptr_Type := El_Tinfo.B.Base_Ptr_Type; diff --git a/src/vhdl/translate/trans-chap6.adb b/src/vhdl/translate/trans-chap6.adb index eb757d9c7..e21836a28 100644 --- a/src/vhdl/translate/trans-chap6.adb +++ b/src/vhdl/translate/trans-chap6.adb @@ -865,6 +865,7 @@ package body Trans.Chap6 is (Prefix : Mnode; El : Iir_Element_Declaration) return Mnode is El_Type : constant Iir := Get_Type (El); + El_Btype : constant Iir := Get_Base_Type (El_Type); El_Tinfo : constant Type_Info_Acc := Get_Info (El_Type); Kind : constant Object_Kind_Type := Get_Object_Kind (Prefix); Base_El : constant Iir := Get_Base_Element_Declaration (El); @@ -963,8 +964,10 @@ package body Trans.Chap6 is if Is_Unbounded_Type (El_Tinfo) then -- Ok, we know that Get_Composite_Base doesn't return a copy. - New_Assign_Stmt (M2Lp (Chap3.Get_Composite_Base (Fat_Res)), - M2Addr (Res)); + New_Assign_Stmt + (M2Lp (Chap3.Get_Composite_Base (Fat_Res)), + New_Convert_Ov (M2Addr (Res), + Get_Info (El_Btype).B.Base_Ptr_Type (Kind))); return Fat_Res; else return Res; diff --git a/src/vhdl/translate/trans-rtis.adb b/src/vhdl/translate/trans-rtis.adb index a36bcc076..e4914d1f7 100644 --- a/src/vhdl/translate/trans-rtis.adb +++ b/src/vhdl/translate/trans-rtis.adb @@ -1527,8 +1527,6 @@ package body Trans.Rtis is Base_Info : constant Type_Info_Acc := Get_Info (Base_Type); Aggr : O_Record_Aggr_List; Val : O_Cnode; - Base_Rti : O_Dnode; - pragma Unreferenced (Base_Rti); Bounds : Var_Type; Name : O_Dnode; Kind : O_Cnode; @@ -1582,8 +1580,8 @@ package body Trans.Rtis is pragma Unreferenced (Base_Rti); Mark : Id_Mark_Type; begin - -- FIXME: temporary work-around - if Get_Constraint_State (Atype) /= Fully_Constrained then + if Base_Info = Get_Info (Atype) then + -- An alias, or no added constraints. return; end if; |