aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/synth-decls.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-03-29 08:28:33 +0200
committerTristan Gingold <tgingold@free.fr>2020-03-29 08:28:33 +0200
commit6739ef05016a6148f899be092a4e9bb4512d0d78 (patch)
treeeea2dcd35278eb8c6cc0602b1aa972eb8da41072 /src/synth/synth-decls.adb
parent79267f4dc60753aac17f2192a9f6eee5e2ef7b75 (diff)
downloadghdl-6739ef05016a6148f899be092a4e9bb4512d0d78.tar.gz
ghdl-6739ef05016a6148f899be092a4e9bb4512d0d78.tar.bz2
ghdl-6739ef05016a6148f899be092a4e9bb4512d0d78.zip
synth: fix handling of subtype indication in object aliases for vhdl 2008.
Fix #1175
Diffstat (limited to 'src/synth/synth-decls.adb')
-rw-r--r--src/synth/synth-decls.adb12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/synth/synth-decls.adb b/src/synth/synth-decls.adb
index 263070ff4..704e6a65d 100644
--- a/src/synth/synth-decls.adb
+++ b/src/synth/synth-decls.adb
@@ -752,7 +752,7 @@ package body Synth.Decls is
procedure Synth_Object_Alias_Declaration
(Syn_Inst : Synth_Instance_Acc; Decl : Node)
is
- Atype : constant Node := Get_Type (Decl);
+ Atype : constant Node := Get_Declaration_Type (Decl);
Obj : Value_Acc;
Off : Uns32;
Voff : Net;
@@ -762,10 +762,12 @@ package body Synth.Decls is
Obj_Type : Type_Acc;
begin
-- Subtype indication may not be present.
- if Is_Anonymous_Type_Definition (Atype) then
+ if Atype /= Null_Node then
Synth_Subtype_Indication (Syn_Inst, Atype);
+ Obj_Type := Get_Value_Type (Syn_Inst, Atype);
+ else
+ Obj_Type := null;
end if;
- Obj_Type := Get_Value_Type (Syn_Inst, Atype);
Stmts.Synth_Assignment_Prefix (Syn_Inst, Get_Name (Decl),
Obj, Off, Voff, Rdwd, Typ);
@@ -778,7 +780,9 @@ package body Synth.Decls is
else
Res := Create_Value_Alias (Obj, Off, Typ);
end if;
- Res := Synth_Subtype_Conversion (Res, Obj_Type, True, Decl);
+ if Obj_Type /= null then
+ Res := Synth_Subtype_Conversion (Res, Obj_Type, True, Decl);
+ end if;
Create_Object (Syn_Inst, Decl, Res);
end Synth_Object_Alias_Declaration;