diff options
author | Tristan Gingold <tgingold@free.fr> | 2018-07-19 20:52:57 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2018-07-20 18:09:07 +0200 |
commit | e6688012fdc05e60dbcf2e5f85e8169d3f3e25aa (patch) | |
tree | 16fe31fb89f06eaaebbb4efb5f87a0e3a079688a | |
parent | 18116ef10e66015fa9445fcb072441d035a282b9 (diff) | |
download | ghdl-e6688012fdc05e60dbcf2e5f85e8169d3f3e25aa.tar.gz ghdl-e6688012fdc05e60dbcf2e5f85e8169d3f3e25aa.tar.bz2 ghdl-e6688012fdc05e60dbcf2e5f85e8169d3f3e25aa.zip |
sem_type: avoid crash after error in record constraint.
Fix #623
-rw-r--r-- | src/vhdl/sem_types.adb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/vhdl/sem_types.adb b/src/vhdl/sem_types.adb index d4439b6ab..843f549e4 100644 --- a/src/vhdl/sem_types.adb +++ b/src/vhdl/sem_types.adb @@ -1903,6 +1903,9 @@ package body Sem_Types is for I in Flist_First .. Flist_Last (Index_List) loop Index_El := Get_Nth_Element (Index_List, I); El := Reparse_As_Record_Element_Constraint (Index_El); + if El = Null_Iir then + return Create_Error_Type (Type_Mark); + end if; Set_Nth_Element (El_List, I, El); end loop; @@ -1945,8 +1948,8 @@ package body Sem_Types is if El_List /= Null_Iir_Flist then for I in Flist_First .. Flist_Last (El_List) loop El := Get_Nth_Element (El_List, I); - Tm_El := - Find_Name_In_Flist (Tm_El_List, Get_Identifier (El)); + Tm_El := Find_Name_In_Flist + (Tm_El_List, Get_Identifier (El)); if Tm_El = Null_Iir then -- Constraint element references an element name that -- doesn't exist. @@ -2324,7 +2327,9 @@ package body Sem_Types is Res := Sem_Subtype_Constraint (Def, Type_Mark, Get_Resolution_Indication (Def)); - Set_Subtype_Type_Mark (Res, Type_Mark_Name); + if not Is_Error (Res) then + Set_Subtype_Type_Mark (Res, Type_Mark_Name); + end if; return Res; end Sem_Subtype_Indication; |