aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vhdl/vhdl-sem.adb31
-rw-r--r--src/vhdl/vhdl-sem_assocs.adb6
-rw-r--r--src/vhdl/vhdl-sem_names.adb5
-rw-r--r--src/vhdl/vhdl-sem_specs.adb6
-rw-r--r--src/vhdl/vhdl-sem_types.adb6
5 files changed, 40 insertions, 14 deletions
diff --git a/src/vhdl/vhdl-sem.adb b/src/vhdl/vhdl-sem.adb
index 0de4c2c7d..20b5f13ad 100644
--- a/src/vhdl/vhdl-sem.adb
+++ b/src/vhdl/vhdl-sem.adb
@@ -128,6 +128,9 @@ package body Vhdl.Sem is
Entity := Get_Library_Unit (Entity);
Set_Named_Entity (Name, Entity);
Xrefs.Xref_Ref (Name, Entity);
+ elsif Get_Kind (Name) not in Iir_Kinds_Denoting_Name then
+ Error_Msg_Sem (+Name, "entity name expected");
+ return Null_Iir;
else
-- Certainly an expanded name. Use the standard name analysis.
Name := Sem_Denoting_Name (Name);
@@ -3058,17 +3061,23 @@ package body Vhdl.Sem is
Name : Iir;
Pkg : Iir;
begin
- Name := Sem_Denoting_Name (Get_Uninstantiated_Package_Name (Decl));
- Set_Uninstantiated_Package_Name (Decl, Name);
- Pkg := Get_Named_Entity (Name);
- if Is_Error (Pkg) then
- null;
- elsif Get_Kind (Pkg) /= Iir_Kind_Package_Declaration then
- Error_Class_Match (Name, "package");
- Pkg := Create_Error (Pkg);
- elsif not Is_Uninstantiated_Package (Pkg) then
- Error_Msg_Sem (+Name, "%n is not an uninstantiated package", +Pkg);
- Pkg := Create_Error (Pkg);
+ Name := Get_Uninstantiated_Package_Name (Decl);
+ if Get_Kind (Name) not in Iir_Kinds_Denoting_Name then
+ Error_Msg_Sem (+Name, "uninstantiated package name expected");
+ Pkg := Create_Error (Name);
+ else
+ Name := Sem_Denoting_Name (Name);
+ Set_Uninstantiated_Package_Name (Decl, Name);
+ Pkg := Get_Named_Entity (Name);
+ if Is_Error (Pkg) then
+ null;
+ elsif Get_Kind (Pkg) /= Iir_Kind_Package_Declaration then
+ Error_Class_Match (Name, "package");
+ Pkg := Create_Error (Pkg);
+ elsif not Is_Uninstantiated_Package (Pkg) then
+ Error_Msg_Sem (+Name, "%n is not an uninstantiated package", +Pkg);
+ Pkg := Create_Error (Pkg);
+ end if;
end if;
Set_Uninstantiated_Package_Decl (Decl, Pkg);
diff --git a/src/vhdl/vhdl-sem_assocs.adb b/src/vhdl/vhdl-sem_assocs.adb
index 7af5ecca6..41c93273f 100644
--- a/src/vhdl/vhdl-sem_assocs.adb
+++ b/src/vhdl/vhdl-sem_assocs.adb
@@ -1571,6 +1571,12 @@ package body Vhdl.Sem_Assocs is
-- Analyze actual.
Actual := Get_Actual (Assoc);
+ if Get_Kind (Actual) not in Iir_Kinds_Denoting_Name then
+ Error_Msg_Sem
+ (+Assoc,
+ "actual of association must denote a package instantiation");
+ return;
+ end if;
Actual := Sem_Denoting_Name (Actual);
Set_Actual (Assoc, Actual);
diff --git a/src/vhdl/vhdl-sem_names.adb b/src/vhdl/vhdl-sem_names.adb
index c9420ba4b..043ca36e8 100644
--- a/src/vhdl/vhdl-sem_names.adb
+++ b/src/vhdl/vhdl-sem_names.adb
@@ -962,7 +962,7 @@ package body Vhdl.Sem_Names is
if Get_Kind (Res) in Iir_Kinds_Denoting_Name then
Set_Named_Entity (Res, Atype);
else
- return Create_Error_Type (Name);
+ Res := Create_Error_Type (Name);
end if;
elsif not Incomplete then
if Get_Kind (Atype) = Iir_Kind_Incomplete_Type_Definition then
@@ -5017,7 +5017,8 @@ package body Vhdl.Sem_Names is
Atype : Iir;
begin
case Get_Kind (Name) is
- when Iir_Kinds_Denoting_Name =>
+ when Iir_Kinds_Denoting_Name
+ | Iir_Kind_Attribute_Name =>
-- Common correct case.
Atype := Get_Named_Entity (Name);
case Get_Kind (Atype) is
diff --git a/src/vhdl/vhdl-sem_specs.adb b/src/vhdl/vhdl-sem_specs.adb
index 9418fb9de..e75c786fb 100644
--- a/src/vhdl/vhdl-sem_specs.adb
+++ b/src/vhdl/vhdl-sem_specs.adb
@@ -1268,7 +1268,11 @@ package body Vhdl.Sem_Specs is
if Is_Error (Entity_Name) then
return Null_Iir;
end if;
- Entity_Name := Sem_Denoting_Name (Get_Entity_Name (Aspect));
+ if Get_Kind (Entity_Name) not in Iir_Kinds_Denoting_Name then
+ Error_Msg_Sem (+Entity_Name, "name of an entity expected");
+ return Null_Iir;
+ end if;
+ Entity_Name := Sem_Denoting_Name (Entity_Name);
Set_Entity_Name (Aspect, Entity_Name);
Entity := Get_Named_Entity (Entity_Name);
if Entity = Error_Mark then
diff --git a/src/vhdl/vhdl-sem_types.adb b/src/vhdl/vhdl-sem_types.adb
index 31f5f2294..eb3b7e9a7 100644
--- a/src/vhdl/vhdl-sem_types.adb
+++ b/src/vhdl/vhdl-sem_types.adb
@@ -1749,6 +1749,9 @@ package body Vhdl.Sem_Types is
Error_Msg_Sem
(+Resolution,
"record resolution not allowed for array subtype");
+ when Iir_Kind_Attribute_Name =>
+ Error_Msg_Sem
+ (+Resolution, "%n not allowed as resolution", +Resolution);
when others =>
Error_Kind ("sem_array_constraint(resolution)", Resolution);
end case;
@@ -2056,6 +2059,9 @@ package body Vhdl.Sem_Types is
Error_Msg_Sem
(+Resolution,
"resolution indication must be an array element resolution");
+ when Iir_Kind_Attribute_Name =>
+ Error_Msg_Sem
+ (+Resolution, "%n not allowed as resolution", +Resolution);
when others =>
Error_Kind ("sem_record_constraint(resolution)", Resolution);
end case;