aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-04-04 06:31:29 +0200
committerTristan Gingold <tgingold@free.fr>2022-04-04 06:31:29 +0200
commitba9341b82ec487d73c4f11ea92154bbabeb83707 (patch)
treedc0a7e867e1827702b4581fcbcfe76a6c9f2d989 /src
parentab2e2eaa2bd8c96b35ae9866b46627fa045cc3f6 (diff)
downloadghdl-ba9341b82ec487d73c4f11ea92154bbabeb83707.tar.gz
ghdl-ba9341b82ec487d73c4f11ea92154bbabeb83707.tar.bz2
ghdl-ba9341b82ec487d73c4f11ea92154bbabeb83707.zip
synth: handle shared variable without default value.
For #2023
Diffstat (limited to 'src')
-rw-r--r--src/synth/elab-vhdl_decls.adb2
-rw-r--r--src/synth/synth-vhdl_decls.adb3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/synth/elab-vhdl_decls.adb b/src/synth/elab-vhdl_decls.adb
index f8a82be14..897705e37 100644
--- a/src/synth/elab-vhdl_decls.adb
+++ b/src/synth/elab-vhdl_decls.adb
@@ -138,7 +138,7 @@ package body Elab.Vhdl_Decls is
Init := Exec_Expression_With_Type (Syn_Inst, Def, Obj_Typ);
Init := Exec_Subtype_Conversion (Init, Obj_Typ, False, Decl);
else
- Init := No_Valtyp;
+ Init := (Typ => Obj_Typ, Val => null);
end if;
Create_Object (Syn_Inst, Decl, Init);
end Elab_Variable_Declaration;
diff --git a/src/synth/synth-vhdl_decls.adb b/src/synth/synth-vhdl_decls.adb
index c7ab62d8e..8d38eaaff 100644
--- a/src/synth/synth-vhdl_decls.adb
+++ b/src/synth/synth-vhdl_decls.adb
@@ -429,6 +429,9 @@ package body Synth.Vhdl_Decls is
Val : Valtyp;
begin
Init := Get_Value (Syn_Inst, Decl);
+ if Init.Val = null then
+ Init := Create_Value_Default (Init.Typ);
+ end if;
Val := Create_Var_Wire (Syn_Inst, Decl, Wire_Variable, Init);
Mutate_Object (Syn_Inst, Decl, Val);