aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-12-11 12:32:28 +0100
committerTristan Gingold <tgingold@free.fr>2022-12-11 12:32:28 +0100
commit285b0484c261a3b46f44d750b11019d3e7604ae4 (patch)
tree401bf5fff97068e842e5e0e39c7d93ed5a6b7ab3 /testsuite/gna
parentca958871af831c19e78a70784599c2bdac8f72a2 (diff)
downloadghdl-285b0484c261a3b46f44d750b11019d3e7604ae4.tar.gz
ghdl-285b0484c261a3b46f44d750b11019d3e7604ae4.tar.bz2
ghdl-285b0484c261a3b46f44d750b11019d3e7604ae4.zip
testsuite/gna: add tests for #2223
Diffstat (limited to 'testsuite/gna')
-rw-r--r--testsuite/gna/issue2223/repro6.vhdl22
-rw-r--r--testsuite/gna/issue2223/repro7.vhdl24
-rwxr-xr-xtestsuite/gna/issue2223/testsuite.sh14
3 files changed, 60 insertions, 0 deletions
diff --git a/testsuite/gna/issue2223/repro6.vhdl b/testsuite/gna/issue2223/repro6.vhdl
new file mode 100644
index 000000000..3bccef565
--- /dev/null
+++ b/testsuite/gna/issue2223/repro6.vhdl
@@ -0,0 +1,22 @@
+entity MemPkgReproducer6 is
+end;
+architecture behav of MemPkgReproducer6 is
+ function InitMemoryBaseType(Size : integer) return integer_vector is
+
+ begin
+ return (1 to Size => 0);
+ end InitMemoryBaseType;
+ subtype MemoryBaseType is integer_vector ;
+ type MemBlockType is array (integer range <>) of MemoryBaseType ;
+ type MemBlockPtrType is access MemBlockType ;
+begin
+ process
+ variable MemArr : MemBlockPtrType;
+ variable BlockWidth, BaseWidth : natural;
+ begin
+ BlockWidth := 4;
+ BaseWidth := 32;
+ MemArr := new MemBlockType'( 0 to BlockWidth - 1 => InitMemoryBaseType(BaseWidth));
+ wait;
+ end process;
+end;
diff --git a/testsuite/gna/issue2223/repro7.vhdl b/testsuite/gna/issue2223/repro7.vhdl
new file mode 100644
index 000000000..23c42e53a
--- /dev/null
+++ b/testsuite/gna/issue2223/repro7.vhdl
@@ -0,0 +1,24 @@
+entity MemPkgReproducer7 is
+end;
+
+architecture behav of MemPkgReproducer7 is
+ function InitMemoryBaseType(Size : integer) return integer_vector is
+
+ begin
+ return (1 to Size => 0);
+ end InitMemoryBaseType;
+ subtype MemoryBaseType is integer_vector ;
+ type MemBlockType is array (integer range <>) of MemoryBaseType ;
+ type MemBlockPtrType is access MemBlockType ;
+ constant INIT_MEM_BASE : integer_vector := InitMemoryBaseType(32) ;
+begin
+ process
+ variable MemArr : MemBlockPtrType;
+ variable BlockWidth, BaseWidth : natural;
+ begin
+ BlockWidth := 4;
+ BaseWidth := 32;
+ MemArr := new MemBlockType'( 0 to BlockWidth - 1 => INIT_MEM_BASE);
+ wait;
+ end process;
+end;
diff --git a/testsuite/gna/issue2223/testsuite.sh b/testsuite/gna/issue2223/testsuite.sh
new file mode 100755
index 000000000..87bbe00a3
--- /dev/null
+++ b/testsuite/gna/issue2223/testsuite.sh
@@ -0,0 +1,14 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+export GHDL_STD_FLAGS=--std=08
+analyze repro6.vhdl
+elab_simulate MemPkgReproducer6
+
+analyze repro7.vhdl
+elab_simulate MemPkgReproducer7
+
+clean
+
+echo "Test successful"