From 9fc6a1b3e2b83dbed76f6792e72034f1bcb056ef Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 8 Oct 2019 20:24:00 +0200 Subject: synth: handle read-only aliases. Fix #973 --- src/synth/synth-decls.adb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/synth/synth-decls.adb') diff --git a/src/synth/synth-decls.adb b/src/synth/synth-decls.adb index fe5883ac3..408e8ecc6 100644 --- a/src/synth/synth-decls.adb +++ b/src/synth/synth-decls.adb @@ -617,7 +617,15 @@ package body Synth.Decls is Stmts.Synth_Assignment_Prefix (Syn_Inst, Get_Name (Decl), Obj, Off, Voff, Rdwd, Typ); pragma Assert (Voff = No_Net); - Res := Create_Value_Alias (Obj, Off, Typ); + if Obj.Kind = Value_Net then + -- Object is a net if it is not writable. Extract the + -- bits for the alias. + Res := Create_Value_Net + (Build2_Extract (Get_Build (Syn_Inst), Obj.N, Off, Typ.W), + Typ); + else + Res := Create_Value_Alias (Obj, Off, Typ); + end if; Res := Synth_Subtype_Conversion (Res, Obj_Type, True, Decl); Create_Object (Syn_Inst, Decl, Res); end; -- cgit v1.2.3