aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-09-29 07:56:24 +0200
committerTristan Gingold <tgingold@free.fr>2020-09-29 07:56:24 +0200
commit7efd2f566be98c1052a3276ec0a308aaef72de7a (patch)
treecd74dc39fdf6e8ea7af4debb4c008505754d7e84 /src
parentb72c4e96c337af037575b3399dfee98e476a9846 (diff)
downloadghdl-7efd2f566be98c1052a3276ec0a308aaef72de7a.tar.gz
ghdl-7efd2f566be98c1052a3276ec0a308aaef72de7a.tar.bz2
ghdl-7efd2f566be98c1052a3276ec0a308aaef72de7a.zip
vhdl-sem_types: improve error handling on index subtypes. Fix #1473
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/vhdl-sem_types.adb10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/vhdl/vhdl-sem_types.adb b/src/vhdl/vhdl-sem_types.adb
index d669c170d..3a60b18eb 100644
--- a/src/vhdl/vhdl-sem_types.adb
+++ b/src/vhdl/vhdl-sem_types.adb
@@ -1051,9 +1051,13 @@ package body Vhdl.Sem_Types is
-- Index_Name is a subtype_indication, which can be a type_mark.
else
-- Avoid errors.
- Index_Name :=
- Build_Simple_Name (Natural_Subtype_Declaration, Index_Type);
- Set_Type (Index_Name, Natural_Subtype_Definition);
+ Index_Name := Create_Iir (Iir_Kind_Integer_Subtype_Definition);
+ Location_Copy (Index_Name, Index_Type);
+ Set_Range_Constraint
+ (Index_Name,
+ Create_Error_Expr (Index_Type, Integer_Subtype_Definition));
+ Set_Parent_Type (Index_Name, Integer_Subtype_Definition);
+ Set_Type_Staticness (Index_Name, Globally);
end if;
Set_Nth_Element (Index_List, I, Index_Name);