From e7ffd3ed6229d70b38b1cbff02be19766aa94419 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 26 Sep 2022 20:11:50 +0200 Subject: simul-vhdl_elab: avoid a crash for null-range signals --- src/simul/simul-vhdl_elab.adb | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src') 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); -- cgit v1.2.3