From 6739ef05016a6148f899be092a4e9bb4512d0d78 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sun, 29 Mar 2020 08:28:33 +0200 Subject: synth: fix handling of subtype indication in object aliases for vhdl 2008. Fix #1175 --- src/synth/synth-decls.adb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/synth') 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; -- cgit v1.2.3