aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/synth-vhdl_stmts.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/synth/synth-vhdl_stmts.adb')
-rw-r--r--src/synth/synth-vhdl_stmts.adb25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/synth/synth-vhdl_stmts.adb b/src/synth/synth-vhdl_stmts.adb
index 23da44f73..f2bf8db0d 100644
--- a/src/synth/synth-vhdl_stmts.adb
+++ b/src/synth/synth-vhdl_stmts.adb
@@ -1834,12 +1834,25 @@ package body Synth.Vhdl_Stmts is
begin
case Info.Kind is
when Target_Simple =>
- if Info.Off = No_Value_Offsets then
- return Info.Obj;
- else
- return Create_Value_Alias
- (Info.Obj, Info.Off, Info.Targ_Type, Instance_Pool);
- end if;
+ declare
+ Obj : Valtyp;
+ begin
+ -- Unshare the value.
+ if Info.Obj.Val.Kind = Value_Memory then
+ -- But for memory value, do not copy the content, as it is
+ -- a reference.
+ Obj := Create_Value_Memory_Pool
+ (Get_Memtyp (Info.Obj), Instance_Pool);
+ else
+ Obj := Unshare (Info.Obj, Instance_Pool);
+ end if;
+ if Info.Off = No_Value_Offsets then
+ return Obj;
+ else
+ return Create_Value_Alias
+ (Obj, Info.Off, Info.Targ_Type, Instance_Pool);
+ end if;
+ end;
when Target_Aggregate =>
raise Internal_Error;
when Target_Memory =>