diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-06-26 07:39:46 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-06-26 07:39:46 +0200 |
commit | ab0733b03849efca10eab69704f5c942a4831332 (patch) | |
tree | 29b9c879ed0f02d41e494a9bf7f186091ddb650a | |
parent | 2e56e2424514b788258f0490af65e316e26715bf (diff) | |
download | ghdl-ab0733b03849efca10eab69704f5c942a4831332.tar.gz ghdl-ab0733b03849efca10eab69704f5c942a4831332.tar.bz2 ghdl-ab0733b03849efca10eab69704f5c942a4831332.zip |
vhdl-parse: fix crashes after error. Fix #2110
-rw-r--r-- | src/vhdl/vhdl-parse.adb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/vhdl/vhdl-parse.adb b/src/vhdl/vhdl-parse.adb index 7529fe2e4..60dfd103c 100644 --- a/src/vhdl/vhdl-parse.adb +++ b/src/vhdl/vhdl-parse.adb @@ -2149,8 +2149,9 @@ package body Vhdl.Parse is if Vhdl_Std < Vhdl_19 then Error_Msg_Parse ("return identifier not allowed before vhdl 2019"); + elsif Get_Kind (Tm) /= Iir_Kind_Simple_Name then + Error_Msg_Parse ("return identifier must be an identifier"); end if; - pragma Assert (Get_Kind (Tm) = Iir_Kind_Simple_Name); Ret := Create_Iir (Iir_Kind_Subtype_Declaration); Location_Copy (Ret, Tm); Set_Identifier (Ret, Get_Identifier (Tm)); @@ -10801,10 +10802,13 @@ package body Vhdl.Parse is -- Parse configuration item list declare First, Last : Iir; + Item : Iir; begin Chain_Init (First, Last); while Current_Token = Tok_For loop - Chain_Append (First, Last, Parse_Configuration_Item); + Item := Parse_Configuration_Item; + exit when Item = Null_Iir; + Chain_Append (First, Last, Item); end loop; Set_Configuration_Item_Chain (Res, First); end; |