aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-06-01 07:56:39 +0200
committerTristan Gingold <tgingold@free.fr>2022-06-01 07:56:39 +0200
commita9e699478dd0eae8d277fe25773fe5969bcf3cde (patch)
treee206c4e4ab549c004adcbb5dde973bbd8c9b1d9b
parent1e5ada114810890ea80223ee07713876eecfa289 (diff)
downloadghdl-a9e699478dd0eae8d277fe25773fe5969bcf3cde.tar.gz
ghdl-a9e699478dd0eae8d277fe25773fe5969bcf3cde.tar.bz2
ghdl-a9e699478dd0eae8d277fe25773fe5969bcf3cde.zip
vhdl: avoid crash after an error. For #2070
-rw-r--r--src/vhdl/vhdl-parse.adb4
-rw-r--r--src/vhdl/vhdl-sem.adb5
-rw-r--r--src/vhdl/vhdl-sem_types.adb4
3 files changed, 10 insertions, 3 deletions
diff --git a/src/vhdl/vhdl-parse.adb b/src/vhdl/vhdl-parse.adb
index 6e574b0a5..48c6de4c9 100644
--- a/src/vhdl/vhdl-parse.adb
+++ b/src/vhdl/vhdl-parse.adb
@@ -2145,7 +2145,7 @@ package body Vhdl.Parse is
Tm := Parse_Type_Mark (Check_Paren => True);
- if Current_Token = Tok_Of then
+ if Tm /= Null_Iir and then Current_Token = Tok_Of then
if Vhdl_Std < Vhdl_19 then
Error_Msg_Parse
("return identifier not allowed before vhdl 2019");
@@ -7358,6 +7358,8 @@ package body Vhdl.Parse is
| Iir_Kind_Signature =>
Error_Msg_Parse
("invalid name for a procedure call or missing assignment");
+ when Iir_Kind_Error =>
+ null;
when others =>
Error_Kind ("parenthesis_name_to_procedure_call", Name);
end case;
diff --git a/src/vhdl/vhdl-sem.adb b/src/vhdl/vhdl-sem.adb
index ce0428476..74a0dfc85 100644
--- a/src/vhdl/vhdl-sem.adb
+++ b/src/vhdl/vhdl-sem.adb
@@ -2844,7 +2844,10 @@ package body Vhdl.Sem is
Pkg : constant Iir :=
Get_Uninstantiated_Package_Decl (Inter);
begin
- if Get_Macro_Expanded_Flag (Pkg) then
+ -- Could be an error.
+ if Get_Kind (Pkg) = Iir_Kind_Package_Declaration
+ and then Get_Macro_Expanded_Flag (Pkg)
+ then
return True;
end if;
end;
diff --git a/src/vhdl/vhdl-sem_types.adb b/src/vhdl/vhdl-sem_types.adb
index 3d77d8ab5..f4f142f6a 100644
--- a/src/vhdl/vhdl-sem_types.adb
+++ b/src/vhdl/vhdl-sem_types.adb
@@ -2455,7 +2455,9 @@ package body Vhdl.Sem_Types is
Res := Sem_Subtype_Constraint
(Def, Type_Mark, Get_Resolution_Indication (Def));
- if not Is_Error (Res) then
+ if not Is_Error (Res)
+ and then Get_Kind (Res) in Iir_Kinds_Subtype_Definition
+ then
Set_Subtype_Type_Mark (Res, Type_Mark_Name);
end if;
return Res;