aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-09-30 01:20:51 +0200
committerTristan Gingold <tgingold@free.fr>2019-09-30 01:20:51 +0200
commite7c2690467b8f0fc3ac85f07843b45723204c86e (patch)
treefb41f04c9a052f0cf5bf8d61e36205d63db4ec9b
parent108c48221f7a367b2b33499b469eab0afcaafd43 (diff)
downloadghdl-e7c2690467b8f0fc3ac85f07843b45723204c86e.tar.gz
ghdl-e7c2690467b8f0fc3ac85f07843b45723204c86e.tar.bz2
ghdl-e7c2690467b8f0fc3ac85f07843b45723204c86e.zip
synth: convert subtype in alias declaration. Fix #946
-rw-r--r--src/synth/synth-decls.adb8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/synth/synth-decls.adb b/src/synth/synth-decls.adb
index 9b5fbad14..24f4aa9cf 100644
--- a/src/synth/synth-decls.adb
+++ b/src/synth/synth-decls.adb
@@ -540,11 +540,15 @@ package body Synth.Decls is
Obj : Value_Acc;
Off : Uns32;
Typ : Type_Acc;
+ Res : Value_Acc;
+ Obj_Type : Type_Acc;
begin
+ Obj_Type := Get_Value_Type (Syn_Inst, Get_Type (Decl));
Stmts.Synth_Assignment_Prefix (Syn_Inst, Get_Name (Decl),
Obj, Off, Typ);
- Create_Object (Syn_Inst, Decl,
- Create_Value_Alias (Obj, Off, Typ));
+ Res := Create_Value_Alias (Obj, Off, Typ);
+ Res := Synth_Subtype_Conversion (Res, Obj_Type, True, Decl);
+ Create_Object (Syn_Inst, Decl, Res);
end;
when Iir_Kind_Anonymous_Signal_Declaration =>
Make_Object (Syn_Inst, Wire_Signal, Decl);