aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-06-06 06:49:30 +0200
committerTristan Gingold <tgingold@free.fr>2019-06-06 06:49:30 +0200
commit7ee4c575adfaa0036d97c1cc5fa53a6c23f68f5e (patch)
treea4b08826088af5abf7896ea47e698cdec658dc8b /src
parentfb8e0c5259beb29d0a4f09d797cb3dff2dbfe334 (diff)
downloadghdl-7ee4c575adfaa0036d97c1cc5fa53a6c23f68f5e.tar.gz
ghdl-7ee4c575adfaa0036d97c1cc5fa53a6c23f68f5e.tar.bz2
ghdl-7ee4c575adfaa0036d97c1cc5fa53a6c23f68f5e.zip
synth-expr: fix a crash in vectorize_array
Diffstat (limited to 'src')
-rw-r--r--src/synth/synth-expr.adb5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb
index 147ce8a1b..092e10cdb 100644
--- a/src/synth/synth-expr.adb
+++ b/src/synth/synth-expr.adb
@@ -227,7 +227,7 @@ package body Synth.Expr is
procedure Free_Net_Array is new Ada.Unchecked_Deallocation
(Net_Array, Net_Array_Acc);
- -- Convert the one-dimension VAL to a net.
+ -- Convert the one-dimension VAL to a net by concatenating.
function Vectorize_Array (Val : Value_Acc) return Value_Acc
is
Arr : Net_Array_Acc;
@@ -237,6 +237,8 @@ package body Synth.Expr is
begin
-- Dynamically allocate ARR to handle large arrays.
Arr := new Net_Array (1 .. Val.Arr.Len);
+
+ -- Gather consecutive constant values.
Idx := 1;
Len := 0;
while Idx <= Val.Arr.Len loop
@@ -261,6 +263,7 @@ package body Synth.Expr is
end loop;
if Off = 0 then
E := Get_Net (Val.Arr.V (Idx));
+ Idx := Idx + 1;
else
if W_Zx = 0 then
E := Build_Const_UB32