aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-10-14 06:44:01 +0200
committerTristan Gingold <tgingold@free.fr>2022-10-14 06:44:01 +0200
commit8e6943c87ed9bfbc199bd4a8297bc87d80286b57 (patch)
treefe77d56fc730b33fdb0e5d7e4e1c33bad6ea87b4 /src/synth
parent0cb267c3cd2fad19d74ff04340b1fdd65055d9e4 (diff)
downloadghdl-8e6943c87ed9bfbc199bd4a8297bc87d80286b57.tar.gz
ghdl-8e6943c87ed9bfbc199bd4a8297bc87d80286b57.tar.bz2
ghdl-8e6943c87ed9bfbc199bd4a8297bc87d80286b57.zip
synth: avoid extra conversion during alias elaboration
Diffstat (limited to 'src/synth')
-rw-r--r--src/synth/elab-vhdl_decls.adb10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/synth/elab-vhdl_decls.adb b/src/synth/elab-vhdl_decls.adb
index bbcd00296..111e8f667 100644
--- a/src/synth/elab-vhdl_decls.adb
+++ b/src/synth/elab-vhdl_decls.adb
@@ -225,7 +225,6 @@ package body Elab.Vhdl_Decls is
procedure Elab_Object_Alias_Declaration
(Syn_Inst : Synth_Instance_Acc; Decl : Node)
is
- Atype : constant Node := Get_Declaration_Type (Decl);
Marker : Mark_Type;
Off : Value_Offsets;
Res : Valtyp;
@@ -235,10 +234,8 @@ package body Elab.Vhdl_Decls is
begin
Mark_Expr_Pool (Marker);
- -- Subtype indication may not be present.
- if Atype /= Null_Node then
- Synth_Subtype_Indication (Syn_Inst, Atype);
- Obj_Typ := Get_Subtype_Object (Syn_Inst, Atype);
+ if Get_Subtype_Indication (Decl) /= Null_Node then
+ Obj_Typ := Elab_Declaration_Type (Syn_Inst, Decl);
else
Obj_Typ := null;
end if;
@@ -246,7 +243,8 @@ package body Elab.Vhdl_Decls is
Synth_Assignment_Prefix (Syn_Inst, Get_Name (Decl), Base, Typ, Off);
Typ := Unshare (Typ, Instance_Pool);
Res := Create_Value_Alias (Base, Off, Typ, Expr_Pool'Access);
- if Obj_Typ /= null then
+ if Obj_Typ /= null and then Obj_Typ.Kind not in Type_Scalars then
+ -- Reshape bounds.
Res := Exec_Subtype_Conversion (Res, Obj_Typ, True, Decl);
end if;
Res := Unshare (Res, Instance_Pool);