aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-05-18 14:18:07 +0200
committerTristan Gingold <tgingold@free.fr>2022-05-18 14:18:07 +0200
commitca53fab7cf13635747450b16525f5545c4b8bfe1 (patch)
tree38956ece99ba63a8ecbeb3e17d9dfa52b80f540d /testsuite/synth
parent754c9ad605bc94bcc377a3b1666fb7fb4bcf72c2 (diff)
downloadghdl-ca53fab7cf13635747450b16525f5545c4b8bfe1.tar.gz
ghdl-ca53fab7cf13635747450b16525f5545c4b8bfe1.tar.bz2
ghdl-ca53fab7cf13635747450b16525f5545c4b8bfe1.zip
testsuite/synth: add a test for #2063
Diffstat (limited to 'testsuite/synth')
-rw-r--r--testsuite/synth/issue2063/array_index_crash.vhdl32
-rwxr-xr-xtestsuite/synth/issue2063/testsuite.sh7
2 files changed, 39 insertions, 0 deletions
diff --git a/testsuite/synth/issue2063/array_index_crash.vhdl b/testsuite/synth/issue2063/array_index_crash.vhdl
new file mode 100644
index 000000000..2be4b0206
--- /dev/null
+++ b/testsuite/synth/issue2063/array_index_crash.vhdl
@@ -0,0 +1,32 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+entity array_index_crash is
+end entity;
+
+architecture behaviour of array_index_crash is
+
+ constant SIZE : integer := 8;
+ constant AMIN : integer := 0;
+ constant AMAX : integer := 7;
+
+ subtype data_t is std_logic_vector((SIZE-1) downto 0);
+ type data_arr_t is array(AMIN to AMAX) of data_t;
+
+ function initialise return data_arr_t is
+ variable ret : data_arr_t;
+ variable itv : integer;
+ begin
+ for i in AMIN to AMAX
+ loop
+ itv := 2*AMAX;
+ -- vvv oops
+ ret(itv) := std_logic_vector(to_unsigned(itv, SIZE));
+ end loop;
+ return ret;
+ end function;
+
+ constant data_arr : data_arr_t := initialise;
+begin
+end architecture;
diff --git a/testsuite/synth/issue2063/testsuite.sh b/testsuite/synth/issue2063/testsuite.sh
new file mode 100755
index 000000000..d9e33478f
--- /dev/null
+++ b/testsuite/synth/issue2063/testsuite.sh
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+synth_failure array_index_crash.vhdl -e
+
+echo "Test successful"