aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-12-17 07:47:52 +0100
committerTristan Gingold <tgingold@free.fr>2018-12-17 07:47:52 +0100
commit895702308daaa9becbacc5fd5e2906960be878cc (patch)
tree74b8e6db1ea351cff0f91791472542fef9a77298 /src
parentad35e3e0d33ff08872c73ee810c2bbf34bd788ef (diff)
downloadghdl-895702308daaa9becbacc5fd5e2906960be878cc.tar.gz
ghdl-895702308daaa9becbacc5fd5e2906960be878cc.tar.bz2
ghdl-895702308daaa9becbacc5fd5e2906960be878cc.zip
sem_decls: tolerate parse error on subtype indication.
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/iirs_utils.adb6
-rw-r--r--src/vhdl/sem_decls.adb11
2 files changed, 12 insertions, 5 deletions
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);