aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-03-21 16:20:02 +0100
committerTristan Gingold <tgingold@free.fr>2021-03-21 16:20:02 +0100
commita3b788fa4f5cf8f5e39d07cbfc427c2f4f521cdc (patch)
treee6d454d90b7b4ac3d2fc281b88b8dadaefd93cd5 /testsuite
parent4bc549728f6b970060fe47c0b59f1c8f0fa6b459 (diff)
downloadghdl-a3b788fa4f5cf8f5e39d07cbfc427c2f4f521cdc.tar.gz
ghdl-a3b788fa4f5cf8f5e39d07cbfc427c2f4f521cdc.tar.bz2
ghdl-a3b788fa4f5cf8f5e39d07cbfc427c2f4f521cdc.zip
testsuite/gna: add a test for #1689
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/gna/issue1689/test.vhdl28
-rwxr-xr-xtestsuite/gna/issue1689/testsuite.sh11
2 files changed, 39 insertions, 0 deletions
diff --git a/testsuite/gna/issue1689/test.vhdl b/testsuite/gna/issue1689/test.vhdl
new file mode 100644
index 000000000..a35a9f42b
--- /dev/null
+++ b/testsuite/gna/issue1689/test.vhdl
@@ -0,0 +1,28 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+entity test is
+end entity test;
+
+architecture beh of test is
+ type t_slv_array is array (natural range <>) of std_logic_vector;
+ constant test_val : t_slv_array(0 to 1)(15 downto 0) := (others => x"BBBB");
+begin
+
+ process
+ variable v_val : t_slv_array(0 to test_val'length)(15 downto 0);
+ -- Change test_val'length to 2 and it works
+ begin
+ report "test_val'length " & to_string(test_val'length)
+ & " v_val'length " & to_string(v_val'length);
+ v_val(0) := x"AAAA";
+ v_val(1 to 2) := test_val;
+ assert v_val(0) = x"AAAA"
+ report "Incorrect value, v_val is: " & to_hstring(v_val(0))
+ & " " & to_hstring(v_val(1)) & " " & to_hstring(v_val(2))
+ severity failure;
+ wait;
+ end process;
+
+end architecture beh;
diff --git a/testsuite/gna/issue1689/testsuite.sh b/testsuite/gna/issue1689/testsuite.sh
new file mode 100755
index 000000000..1d84c0f57
--- /dev/null
+++ b/testsuite/gna/issue1689/testsuite.sh
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+export GHDL_STD_FLAGS=--std=08
+analyze test.vhdl
+elab_simulate test
+
+clean
+
+echo "Test successful"