From 895702308daaa9becbacc5fd5e2906960be878cc Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 17 Dec 2018 07:47:52 +0100 Subject: sem_decls: tolerate parse error on subtype indication. --- src/vhdl/iirs_utils.adb | 6 ++++-- src/vhdl/sem_decls.adb | 11 ++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/vhdl/iirs_utils.adb b/src/vhdl/iirs_utils.adb index 536238bef..32e52f77f 100644 --- a/src/vhdl/iirs_utils.adb +++ b/src/vhdl/iirs_utils.adb @@ -1571,8 +1571,10 @@ package body Iirs_Utils is Res : Iir; begin Res := Create_Iir (Iir_Kind_Error); - Set_Error_Origin (Res, Orig); - Location_Copy (Res, Orig); + if Orig /= Null_Iir then + Set_Error_Origin (Res, Orig); + Location_Copy (Res, Orig); + end if; return Res; end Create_Error; diff --git a/src/vhdl/sem_decls.adb b/src/vhdl/sem_decls.adb index 5d6e67596..ea89ff2fe 100644 --- a/src/vhdl/sem_decls.adb +++ b/src/vhdl/sem_decls.adb @@ -201,9 +201,14 @@ package body Sem_Decls is -- been freed. A_Type := Get_Subtype_Indication (Inter); if A_Type = Null_Iir then - pragma Assert (Last /= Null_Iir); - A_Type := Get_Type (Last); - Default_Value := Get_Default_Value (Last); + if Last = Null_Iir or else not Get_Has_Identifier_List (Last) then + -- Subtype indication was not parsed. + A_Type := Create_Error_Type (Null_Iir); + Set_Subtype_Indication (Inter, A_Type); + else + A_Type := Get_Type (Last); + Default_Value := Get_Default_Value (Last); + end if; else A_Type := Sem_Subtype_Indication (A_Type); Set_Subtype_Indication (Inter, A_Type); -- cgit v1.2.3