aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-03-04 07:59:57 +0100
committerTristan Gingold <tgingold@free.fr>2022-03-04 07:59:57 +0100
commitb2004fe30edc17a7534d510dedfdcdeb205adfae (patch)
tree445eccc8198cd62d62f45ff2cd8ef4006081edc4
parentecade8c59b545e5232273aca11d3f2e69fee29cd (diff)
downloadghdl-b2004fe30edc17a7534d510dedfdcdeb205adfae.tar.gz
ghdl-b2004fe30edc17a7534d510dedfdcdeb205adfae.tar.bz2
ghdl-b2004fe30edc17a7534d510dedfdcdeb205adfae.zip
testsuite/gna: add a testcase for #1992
-rw-r--r--testsuite/gna/issue1992/bug.vhdl41
-rwxr-xr-xtestsuite/gna/issue1992/testsuite.sh10
2 files changed, 51 insertions, 0 deletions
diff --git a/testsuite/gna/issue1992/bug.vhdl b/testsuite/gna/issue1992/bug.vhdl
new file mode 100644
index 000000000..0d5104a20
--- /dev/null
+++ b/testsuite/gna/issue1992/bug.vhdl
@@ -0,0 +1,41 @@
+library IEEE;
+use IEEE.std_logic_1164.all;
+use IEEE.numeric_std.all;
+
+entity bug is
+ port (
+ clk : in std_ulogic
+ );
+end bug;
+
+architecture struct of bug is
+
+ type a_t is record
+ value : unsigned;
+ end record;
+
+ type a_array_t is array(natural range<>) of a_t;
+
+ type b_t is record
+ a : a_array_t;
+ end record;
+
+ type b_array_t is array(natural range<>) of b_t;
+
+ function fun(b : b_array_t) return natural is
+ variable c : natural;
+ begin
+ c := 0;
+ for i in b'range loop
+ for j in b'element.a'range loop
+ c := c+1;
+ end loop;
+ end loop;
+ return c;
+ end function;
+
+ constant b : b_array_t(0 to 1)(a(0 to 31)(value(31 downto 0))) := (others => (a => (others => (value => (others => '0' )))));
+
+ constant dummy : natural := fun(b);
+begin
+end architecture;
diff --git a/testsuite/gna/issue1992/testsuite.sh b/testsuite/gna/issue1992/testsuite.sh
new file mode 100755
index 000000000..ca85f3d73
--- /dev/null
+++ b/testsuite/gna/issue1992/testsuite.sh
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+export GHDL_STD_FLAGS=--std=08
+analyze_failure bug.vhdl
+
+clean
+
+echo "Test successful"