From ca53fab7cf13635747450b16525f5545c4b8bfe1 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 18 May 2022 14:18:07 +0200 Subject: testsuite/synth: add a test for #2063 --- testsuite/synth/issue2063/array_index_crash.vhdl | 32 ++++++++++++++++++++++++ testsuite/synth/issue2063/testsuite.sh | 7 ++++++ 2 files changed, 39 insertions(+) create mode 100644 testsuite/synth/issue2063/array_index_crash.vhdl create mode 100755 testsuite/synth/issue2063/testsuite.sh (limited to 'testsuite/synth') 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" -- cgit v1.2.3