aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/vhdl-annotations.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-06-09 05:33:54 +0200
committerTristan Gingold <tgingold@free.fr>2022-06-09 05:33:54 +0200
commit33740eb403c9dfbe3fc1f75b50de3000535da6bc (patch)
treef3979416a9fb601badf64ef89c38bf05a19188d6 /src/vhdl/vhdl-annotations.adb
parentd54d4128c0c7a58deed223dea03c13ce548166a5 (diff)
downloadghdl-33740eb403c9dfbe3fc1f75b50de3000535da6bc.tar.gz
ghdl-33740eb403c9dfbe3fc1f75b50de3000535da6bc.tar.bz2
ghdl-33740eb403c9dfbe3fc1f75b50de3000535da6bc.zip
vhdl-annotations: avoid a crash with subtype attribute in array.
Fix #2084
Diffstat (limited to 'src/vhdl/vhdl-annotations.adb')
-rw-r--r--src/vhdl/vhdl-annotations.adb9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/vhdl/vhdl-annotations.adb b/src/vhdl/vhdl-annotations.adb
index 21224fe0e..8429d2dab 100644
--- a/src/vhdl/vhdl-annotations.adb
+++ b/src/vhdl/vhdl-annotations.adb
@@ -328,8 +328,13 @@ package body Vhdl.Annotations is
-- Create an annotation for the element type, as it can be
-- referenced by the implicit concat function definition for
-- concatenation with element.
- El := Get_Element_Subtype (Def);
- Annotate_Anonymous_Type_Definition (Block_Info, El);
+ El := Get_Element_Subtype_Indication (Def);
+ if Get_Kind (El) in Iir_Kinds_Subtype_Definition then
+ -- But only if it is a proper new subtype definition
+ -- (ie not a denoting name, or attributes like 'subtype).
+ El := Get_Element_Subtype (Def);
+ Annotate_Anonymous_Type_Definition (Block_Info, El);
+ end if;
-- Then for the array.
Create_Object_Info (Block_Info, Def, Kind_Type);