From e7c2690467b8f0fc3ac85f07843b45723204c86e Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 30 Sep 2019 01:20:51 +0200 Subject: synth: convert subtype in alias declaration. Fix #946 --- src/synth/synth-decls.adb | 8 ++++++-- 1 file 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); -- cgit v1.2.3