aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/vhdl-parse.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-06-26 07:39:46 +0200
committerTristan Gingold <tgingold@free.fr>2022-06-26 07:39:46 +0200
commitab0733b03849efca10eab69704f5c942a4831332 (patch)
tree29b9c879ed0f02d41e494a9bf7f186091ddb650a /src/vhdl/vhdl-parse.adb
parent2e56e2424514b788258f0490af65e316e26715bf (diff)
downloadghdl-ab0733b03849efca10eab69704f5c942a4831332.tar.gz
ghdl-ab0733b03849efca10eab69704f5c942a4831332.tar.bz2
ghdl-ab0733b03849efca10eab69704f5c942a4831332.zip
vhdl-parse: fix crashes after error. Fix #2110
Diffstat (limited to 'src/vhdl/vhdl-parse.adb')
-rw-r--r--src/vhdl/vhdl-parse.adb8
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;