aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-09-26 20:11:50 +0200
committerTristan Gingold <tgingold@free.fr>2022-09-26 20:11:50 +0200
commite7ffd3ed6229d70b38b1cbff02be19766aa94419 (patch)
tree3c7237db32c1e1a314e03038e842f71cb076d0cb
parent0253646671c6000da87d12bebb2166284273ae04 (diff)
downloadghdl-e7ffd3ed6229d70b38b1cbff02be19766aa94419.tar.gz
ghdl-e7ffd3ed6229d70b38b1cbff02be19766aa94419.tar.bz2
ghdl-e7ffd3ed6229d70b38b1cbff02be19766aa94419.zip
simul-vhdl_elab: avoid a crash for null-range signals
-rw-r--r--src/simul/simul-vhdl_elab.adb24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/simul/simul-vhdl_elab.adb b/src/simul/simul-vhdl_elab.adb
index ac2bc25c1..341e33e26 100644
--- a/src/simul/simul-vhdl_elab.adb
+++ b/src/simul/simul-vhdl_elab.adb
@@ -154,16 +154,20 @@ package body Simul.Vhdl_Elab is
end if;
E.Sig := null;
- if E.Kind in Mode_Signal_User and then E.Typ.W > 0 then
- E.Nbr_Sources :=
- new Nbr_Sources_Array'(0 .. E.Typ.W - 1 =>
- (Nbr_Drivers => 0,
- Nbr_Conns => 0,
- Total => 0,
- Last_Proc => No_Process_Index));
-
- Mark_Resolved_Signals
- (0, Get_Type (E.Decl), E.Typ, E.Nbr_Sources.all, False);
+ if E.Kind in Mode_Signal_User then
+ if E.Typ.W > 0 then
+ E.Nbr_Sources :=
+ new Nbr_Sources_Array'(0 .. E.Typ.W - 1 =>
+ (Nbr_Drivers => 0,
+ Nbr_Conns => 0,
+ Total => 0,
+ Last_Proc => No_Process_Index));
+
+ Mark_Resolved_Signals
+ (0, Get_Type (E.Decl), E.Typ, E.Nbr_Sources.all, False);
+ else
+ E.Nbr_Sources := new Nbr_Sources_Array (1 .. 0);
+ end if;
end if;
pragma Assert (E.Kind /= Mode_End);