diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-01-09 15:57:11 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-01-09 15:57:11 +0100 |
commit | 359b7edb9be3912006758570f5a4fd207feba662 (patch) | |
tree | 9ca96f5f06d3923ea6a022a2b1b469fcfeadd847 /testsuite/gna/issue1934 | |
parent | 263c843ed49f59cb4cc3038bafcac2b9238ebad4 (diff) | |
download | ghdl-359b7edb9be3912006758570f5a4fd207feba662.tar.gz ghdl-359b7edb9be3912006758570f5a4fd207feba662.tar.bz2 ghdl-359b7edb9be3912006758570f5a4fd207feba662.zip |
testsuite/gna: add a test for #1934
Diffstat (limited to 'testsuite/gna/issue1934')
-rw-r--r-- | testsuite/gna/issue1934/repro2.vhdl | 34 | ||||
-rw-r--r-- | testsuite/gna/issue1934/test_pkg.vhdl | 29 | ||||
-rwxr-xr-x | testsuite/gna/issue1934/testsuite.sh | 12 |
3 files changed, 75 insertions, 0 deletions
diff --git a/testsuite/gna/issue1934/repro2.vhdl b/testsuite/gna/issue1934/repro2.vhdl new file mode 100644 index 000000000..60d44f0d0 --- /dev/null +++ b/testsuite/gna/issue1934/repro2.vhdl @@ -0,0 +1,34 @@ +package repro2_pkg is + type inner_t is record + value : bit_vector; + end record; + + type inner_array_t is array(natural range<>) of inner_t; + + type outer_t is record + inner : inner_array_t; + end record; + + subtype my_type is outer_t(inner(0 to 31)(value(31 downto 0))); + -- column 44: value + -- column 35: (0 to 31) +end repro2_pkg; + +use work.repro2_pkg.all; + +entity repro2 is +end; + +architecture behav of repro2 is +begin + process + variable v : my_type; + begin + assert v.inner'length = 32 severity failure; + assert v.inner'left = 0 severity failure; + assert v.inner (0).value'length = 32 severity failure; + assert v.inner (31).value'right = 0 severity failure; + wait; + end process; +end behav; + diff --git a/testsuite/gna/issue1934/test_pkg.vhdl b/testsuite/gna/issue1934/test_pkg.vhdl new file mode 100644 index 000000000..a42e53a27 --- /dev/null +++ b/testsuite/gna/issue1934/test_pkg.vhdl @@ -0,0 +1,29 @@ +library IEEE; +use IEEE.std_logic_1164.all; +use IEEE.numeric_std.all; + +package test_pkg is + + type inner_t is record + value : unsigned; + end record; + + type inner_array_t is array(natural range<>) of inner_t; + + type outer_t is record + inner : inner_array_t; + end record; + + function fun return outer_t; + +end test_pkg; + +package body test_pkg is + + function fun return outer_t is + variable ret : outer_t(inner(0 to 31)(value(31 downto 0))); + begin + return ret; + end function; + +end package body test_pkg; diff --git a/testsuite/gna/issue1934/testsuite.sh b/testsuite/gna/issue1934/testsuite.sh new file mode 100755 index 000000000..cd4c92a8a --- /dev/null +++ b/testsuite/gna/issue1934/testsuite.sh @@ -0,0 +1,12 @@ +#! /bin/sh + +. ../../testenv.sh + +export GHDL_STD_FLAGS=--std=08 +analyze test_pkg.vhdl +analyze repro2.vhdl +elab_simulate repro2 + +clean + +echo "Test successful" |