diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-03-29 08:28:33 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-03-29 08:28:33 +0200 |
commit | 6739ef05016a6148f899be092a4e9bb4512d0d78 (patch) | |
tree | eea2dcd35278eb8c6cc0602b1aa972eb8da41072 | |
parent | 79267f4dc60753aac17f2192a9f6eee5e2ef7b75 (diff) | |
download | ghdl-6739ef05016a6148f899be092a4e9bb4512d0d78.tar.gz ghdl-6739ef05016a6148f899be092a4e9bb4512d0d78.tar.bz2 ghdl-6739ef05016a6148f899be092a4e9bb4512d0d78.zip |
synth: fix handling of subtype indication in object aliases for vhdl 2008.
Fix #1175
-rw-r--r-- | src/synth/synth-decls.adb | 12 | ||||
-rw-r--r-- | src/vhdl/vhdl-annotations.adb | 5 |
2 files changed, 12 insertions, 5 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; diff --git a/src/vhdl/vhdl-annotations.adb b/src/vhdl/vhdl-annotations.adb index aef7cafc0..48ec93fc3 100644 --- a/src/vhdl/vhdl-annotations.adb +++ b/src/vhdl/vhdl-annotations.adb @@ -799,7 +799,10 @@ package body Vhdl.Annotations is Annotate_Subprogram_Body (Block_Info, Decl); when Iir_Kind_Object_Alias_Declaration => - Annotate_Anonymous_Type_Definition (Block_Info, Get_Type (Decl)); + if Get_Subtype_Indication (Decl) /= Null_Iir then + Annotate_Anonymous_Type_Definition + (Block_Info, Get_Type (Decl)); + end if; Create_Object_Info (Block_Info, Decl); when Iir_Kind_Non_Object_Alias_Declaration => |