aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2023-04-08 10:29:33 +0200
committerTristan Gingold <tgingold@free.fr>2023-04-08 10:29:33 +0200
commit8bb0ffadf008c5d4b4d3b185243ddce2b4db08c2 (patch)
treec8ad27a74a84e47fb77d8bdbc6f8dedf9e3ae287 /testsuite
parent8336360cbf371c70e3f9f7fd0b73dc278ffebe6d (diff)
downloadghdl-8bb0ffadf008c5d4b4d3b185243ddce2b4db08c2.tar.gz
ghdl-8bb0ffadf008c5d4b4d3b185243ddce2b4db08c2.tar.bz2
ghdl-8bb0ffadf008c5d4b4d3b185243ddce2b4db08c2.zip
testsuite/gna: add a reproducer for #2402
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/gna/issue2402/repro.vhdl46
-rw-r--r--testsuite/gna/issue2402/repro1.vhdl46
-rwxr-xr-xtestsuite/gna/issue2402/testsuite.sh14
3 files changed, 106 insertions, 0 deletions
diff --git a/testsuite/gna/issue2402/repro.vhdl b/testsuite/gna/issue2402/repro.vhdl
new file mode 100644
index 000000000..a1cabaa9e
--- /dev/null
+++ b/testsuite/gna/issue2402/repro.vhdl
@@ -0,0 +1,46 @@
+package gpkg1 is
+ generic (type t;
+ init : t;
+ length : natural);
+
+ function get return t;
+end gpkg1;
+
+package body gpkg1 is
+ type my_rec is record
+ bv : bit_vector (1 to length);
+ end record;
+
+ constant c : t := init;
+
+ function get return t is
+ begin
+ return c;
+ end get;
+end gpkg1;
+
+package gpkg2 is
+-- generic (type t1; init1 : t);
+
+ package g1 is new work.gpkg1
+ generic map (t => natural, init => 11, length => 7);
+
+ function get return natural;
+end gpkg2;
+
+package body gpkg2 is
+ function get return natural is
+ begin
+ return g1.get;
+ end;
+end;
+
+use work.gpkg2.all;
+
+entity repro is
+end;
+
+architecture behav of repro is
+begin
+ assert get = 11 report "done" severity note;
+end behav;
diff --git a/testsuite/gna/issue2402/repro1.vhdl b/testsuite/gna/issue2402/repro1.vhdl
new file mode 100644
index 000000000..6464d3469
--- /dev/null
+++ b/testsuite/gna/issue2402/repro1.vhdl
@@ -0,0 +1,46 @@
+package g1pkg1 is
+ generic (type t;
+ init : t;
+ length : natural);
+
+ function get return t;
+end;
+
+package body g1pkg1 is
+ constant c : t := init;
+
+ type my_rec is record
+ bv : bit_vector (1 to length);
+ end record;
+
+ function get return t is
+ begin
+ return c;
+ end get;
+end;
+
+package g1pkg2 is
+-- generic (type t1; init1 : t);
+
+ package g1 is new work.g1pkg1
+ generic map (t => natural, init => 11, length => 7);
+
+ function get return natural;
+end;
+
+package body g1pkg2 is
+ function get return natural is
+ begin
+ return g1.get;
+ end;
+end;
+
+use work.g1pkg2.all;
+
+entity repro1 is
+end;
+
+architecture behav of repro1 is
+begin
+ assert get = 11 report "done" severity note;
+end behav;
diff --git a/testsuite/gna/issue2402/testsuite.sh b/testsuite/gna/issue2402/testsuite.sh
new file mode 100755
index 000000000..b64078d4f
--- /dev/null
+++ b/testsuite/gna/issue2402/testsuite.sh
@@ -0,0 +1,14 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+export GHDL_STD_FLAGS=--std=08
+analyze repro.vhdl
+elab_simulate repro
+
+analyze repro1.vhdl
+elab_simulate repro1
+
+clean
+
+echo "Test successful"