aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-04-20 19:12:30 +0200
committerTristan Gingold <tgingold@free.fr>2022-04-20 19:12:30 +0200
commit436cbf81e117f3cd12decaa53de7f9d15aaec8bb (patch)
treec23d70db62606fcdc378c54da5566c79913bab2a /src/vhdl
parentecebd7856e1966dae3ed16427fa5a42bd4535c7b (diff)
downloadghdl-436cbf81e117f3cd12decaa53de7f9d15aaec8bb.tar.gz
ghdl-436cbf81e117f3cd12decaa53de7f9d15aaec8bb.tar.bz2
ghdl-436cbf81e117f3cd12decaa53de7f9d15aaec8bb.zip
vhdl-sem_names.adb: avoid a crash on incorrect type mark
Diffstat (limited to 'src/vhdl')
-rw-r--r--src/vhdl/vhdl-sem_names.adb9
-rw-r--r--src/vhdl/vhdl-sem_types.adb4
2 files changed, 12 insertions, 1 deletions
diff --git a/src/vhdl/vhdl-sem_names.adb b/src/vhdl/vhdl-sem_names.adb
index c6566324b..0ce5943cd 100644
--- a/src/vhdl/vhdl-sem_names.adb
+++ b/src/vhdl/vhdl-sem_names.adb
@@ -929,6 +929,15 @@ package body Vhdl.Sem_Names is
return Name;
end if;
+ case Get_Kind (Name) is
+ when Iir_Kinds_Name
+ | Iir_Kind_Attribute_Name =>
+ null;
+ when others =>
+ Error_Msg_Sem (+Name, "name expected for a type mark");
+ return Create_Error_Type (Name);
+ end case;
+
-- Analyze the name (if not already done).
Res := Get_Named_Entity (Name);
if Res = Null_Iir then
diff --git a/src/vhdl/vhdl-sem_types.adb b/src/vhdl/vhdl-sem_types.adb
index fe1777916..3d77d8ab5 100644
--- a/src/vhdl/vhdl-sem_types.adb
+++ b/src/vhdl/vhdl-sem_types.adb
@@ -953,7 +953,9 @@ package body Vhdl.Sem_Types is
Set_Nth_Element (Index_List, I, Index_Type);
Index_Type := Get_Type (Index_Type);
- if Get_Kind (Index_Type) not in Iir_Kinds_Discrete_Type_Definition
+ if Index_Type = Null_Node then
+ null;
+ elsif Get_Kind (Index_Type) not in Iir_Kinds_Discrete_Type_Definition
then
Error_Msg_Sem
(+Index_Type,