aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-10-07 18:19:28 +0200
committerTristan Gingold <tgingold@free.fr>2020-10-07 18:50:09 +0200
commita7339c23f9faff0f392ae7648fdea85bc1ad05d9 (patch)
tree88a9e42a95c35858417c33a88b2984aa3e3c2537 /src
parent4796c4acc40a686f29a390b774b6e98e095ec4f4 (diff)
downloadghdl-a7339c23f9faff0f392ae7648fdea85bc1ad05d9.tar.gz
ghdl-a7339c23f9faff0f392ae7648fdea85bc1ad05d9.tar.bz2
ghdl-a7339c23f9faff0f392ae7648fdea85bc1ad05d9.zip
vhdl-sem_decls: avoid a crash after a parse error.
For both declarations list and missing attribute type.
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/vhdl-sem_decls.adb15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/vhdl/vhdl-sem_decls.adb b/src/vhdl/vhdl-sem_decls.adb
index 64df1cbfb..79f2548ee 100644
--- a/src/vhdl/vhdl-sem_decls.adb
+++ b/src/vhdl/vhdl-sem_decls.adb
@@ -950,7 +950,8 @@ package body Vhdl.Sem_Decls is
end if;
else
pragma Assert (Get_Kind (Last_Decl) = Get_Kind (Decl));
- pragma Assert (Get_Has_Identifier_List (Last_Decl));
+ pragma Assert (Get_Has_Identifier_List (Last_Decl)
+ or Flag_Force_Analysis);
Set_Is_Ref (Decl, True);
Default_Value := Get_Default_Value (Last_Decl);
Atype := Get_Subtype_Indication (Last_Decl);
@@ -1343,9 +1344,15 @@ package body Vhdl.Sem_Decls is
Sem_Scopes.Add_Name (Decl);
Xref_Decl (Decl);
- A_Type := Sem_Type_Mark (Get_Type_Mark (Decl));
- Set_Type_Mark (Decl, A_Type);
- A_Type := Get_Type (A_Type);
+ A_Type := Get_Type_Mark (Decl);
+ if A_Type /= Null_Iir then
+ A_Type := Sem_Type_Mark (A_Type);
+ Set_Type_Mark (Decl, A_Type);
+ A_Type := Get_Type (A_Type);
+ else
+ A_Type := Create_Error_Type (Decl);
+ end if;
+
Set_Type (Decl, A_Type);
-- LRM93 4.4 Attribute declarations.