summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Gingold2015-07-11 07:30:15 +0200
committerTristan Gingold2015-07-11 07:30:15 +0200
commit3756de36c89a5d8e3da0820c3de3d63af0e3f57a (patch)
treee927218731fce5cca1200095a6ecc010c329ef67
parent05a50dfc3123d4e7379885870febb8baeb52a446 (diff)
downloadghdl-3756de36c89a5d8e3da0820c3de3d63af0e3f57a.tar.gz
ghdl-3756de36c89a5d8e3da0820c3de3d63af0e3f57a.tar.bz2
ghdl-3756de36c89a5d8e3da0820c3de3d63af0e3f57a.zip
Defensive code.
-rw-r--r--src/vhdl/iirs_utils.adb5
-rw-r--r--src/vhdl/sem.adb8
2 files changed, 12 insertions, 1 deletions
diff --git a/src/vhdl/iirs_utils.adb b/src/vhdl/iirs_utils.adb
index 4df49b4..ea8f08b 100644
--- a/src/vhdl/iirs_utils.adb
+++ b/src/vhdl/iirs_utils.adb
@@ -21,6 +21,7 @@ with Errorout; use Errorout;
with Name_Table;
with Str_Table;
with Std_Names; use Std_Names;
+with Std_Package;
with Flags; use Flags;
with PSL.Nodes;
with Sem_Inst;
@@ -854,6 +855,10 @@ package body Iirs_Utils is
Name : constant Iir := Get_Entity_Name (Decl);
Res : constant Iir := Get_Named_Entity (Name);
begin
+ if Res = Std_Package.Error_Mark then
+ return Null_Iir;
+ end if;
+
pragma Assert (Res = Null_Iir
or else Get_Kind (Res) = Iir_Kind_Entity_Declaration);
return Res;
diff --git a/src/vhdl/sem.adb b/src/vhdl/sem.adb
index ca44e17..0d67a19 100644
--- a/src/vhdl/sem.adb
+++ b/src/vhdl/sem.adb
@@ -930,6 +930,7 @@ package body Sem is
Arch : Iir_Architecture_Body;
Design: Iir_Design_Unit;
Entity_Aspect : Iir;
+ Entity : Iir;
Comp_Arch : Iir;
begin
Entity_Aspect :=
@@ -962,8 +963,13 @@ package body Sem is
end if;
end if;
+ Entity := Get_Entity (Entity_Aspect);
+ if Entity = Null_Iir then
+ return;
+ end if;
+
Design := Libraries.Load_Secondary_Unit
- (Get_Design_Unit (Get_Entity (Entity_Aspect)),
+ (Get_Design_Unit (Entity),
Get_Identifier (Block_Spec),
Block_Conf);
if Design = Null_Iir then