diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-04-07 17:31:48 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-04-07 17:31:48 +0200 |
commit | 196e52105fa2c6dcaf9fd158607d743c652dea5a (patch) | |
tree | 95ffb5315ae38f836f8ab0ebcb6c85efcdaf6571 | |
parent | 87a468380c789d508acf88c252b5db674cae1b07 (diff) | |
download | ghdl-196e52105fa2c6dcaf9fd158607d743c652dea5a.tar.gz ghdl-196e52105fa2c6dcaf9fd158607d743c652dea5a.tar.bz2 ghdl-196e52105fa2c6dcaf9fd158607d743c652dea5a.zip |
vhdl: fix crash on vhdl08 sub-sub index constraint. For #1191
-rw-r--r-- | src/vhdl/translate/trans-chap3.ads | 1 | ||||
-rw-r--r-- | src/vhdl/translate/trans-chap5.adb | 5 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem_types.adb | 3 |
3 files changed, 5 insertions, 4 deletions
diff --git a/src/vhdl/translate/trans-chap3.ads b/src/vhdl/translate/trans-chap3.ads index cdd3f2715..4bc05de9f 100644 --- a/src/vhdl/translate/trans-chap3.ads +++ b/src/vhdl/translate/trans-chap3.ads @@ -149,6 +149,7 @@ package Trans.Chap3 is return Mnode; -- Index array ARR of type ATYPE with INDEX. + -- Return the base. function Index_Array (Arr : Mnode; Atype : Iir; Index : O_Enode) return Mnode; diff --git a/src/vhdl/translate/trans-chap5.adb b/src/vhdl/translate/trans-chap5.adb index 82518576f..557b4d572 100644 --- a/src/vhdl/translate/trans-chap5.adb +++ b/src/vhdl/translate/trans-chap5.adb @@ -323,9 +323,8 @@ package body Trans.Chap5 is Res : Connect_Data; begin -- FIXME: should check matching elements! - Res := (Actual_Sig => - Chap3.Index_Base (Chap3.Get_Composite_Base (Data.Actual_Sig), - Data.Actual_Type, New_Obj_Value (Index)), + Res := (Actual_Sig => Chap6.Translate_Indexed_Name_By_Offset + (Data.Actual_Sig, Data.Actual_Type, Index), Actual_Type => Get_Element_Subtype (Data.Actual_Type), Mode => Data.Mode, By_Copy => Data.By_Copy); diff --git a/src/vhdl/vhdl-sem_types.adb b/src/vhdl/vhdl-sem_types.adb index 94538eb58..f13010dee 100644 --- a/src/vhdl/vhdl-sem_types.adb +++ b/src/vhdl/vhdl-sem_types.adb @@ -1885,6 +1885,7 @@ package body Vhdl.Sem_Types is if Parent /= Null_Iir then Set_Prefix (Parent, Null_Iir); end if; + Res := Create_Iir (Iir_Kind_Array_Subtype_Definition); Location_Copy (Res, Name); Chain := Get_Association_Chain (Name); @@ -1911,7 +1912,7 @@ package body Vhdl.Sem_Types is if Parent /= Null_Iir then case Get_Kind (Def_El_Type) is when Iir_Kinds_Array_Type_Definition => - Set_Element_Subtype_Indication + Set_Array_Element_Constraint (Res, Reparse_As_Array_Constraint (Def, Def_El_Type)); when others => Error_Kind ("reparse_as_array_constraint", Def_El_Type); |