summaryrefslogtreecommitdiff
path: root/testsuite/gna
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/gna')
-rw-r--r--testsuite/gna/bug02/repro.vhdl29
-rw-r--r--testsuite/gna/bug02/repro2.vhdl45
-rw-r--r--testsuite/gna/bug02/repro3.vhdl49
-rwxr-xr-xtestsuite/gna/bug02/testsuite.sh19
4 files changed, 142 insertions, 0 deletions
diff --git a/testsuite/gna/bug02/repro.vhdl b/testsuite/gna/bug02/repro.vhdl
new file mode 100644
index 0000000..317d6c4
--- /dev/null
+++ b/testsuite/gna/bug02/repro.vhdl
@@ -0,0 +1,29 @@
+entity repro is
+
+end repro;
+
+architecture behav of repro is
+ function inc (a : integer) return integer is
+ begin
+ return a + 1;
+ end inc;
+
+ function inc (a : time) return time is
+ begin
+ return a + 1 ns;
+ end inc;
+
+ procedure inc (a : inout integer) is
+ begin
+ a := inc (a);
+ end inc;
+begin -- behav
+
+ process
+ variable a : integer := 2;
+ begin
+ inc (a);
+ assert a = 3 report "bad value of a";
+ wait;
+ end process;
+end behav;
diff --git a/testsuite/gna/bug02/repro2.vhdl b/testsuite/gna/bug02/repro2.vhdl
new file mode 100644
index 0000000..fa6a2f3
--- /dev/null
+++ b/testsuite/gna/bug02/repro2.vhdl
@@ -0,0 +1,45 @@
+entity repro2 is
+
+end repro2;
+
+package repro2_pkg is
+ procedure inc (a : inout integer);
+ procedure inc (a : inout time);
+end repro2_pkg;
+
+package body repro2_pkg is
+ impure function inc (a : integer) return integer is
+ begin
+ return a + 1;
+ end inc;
+
+ procedure inc (a : inout integer) is
+ begin
+ a := a + 1;
+ end inc;
+
+ procedure inc (a : inout time) is
+ begin
+ a := a + 1 ns;
+ end inc;
+
+ type t is (enum1, inc);
+
+ impure function inc (a : time) return time is
+ begin
+ return a + 1 ns;
+ end inc;
+
+end repro2_pkg;
+
+use work.repro2_pkg.all;
+architecture behav of repro2 is
+begin -- behav
+ process
+ variable a : integer := 2;
+ begin
+ inc (a);
+ assert a = 3 report "bad value of a";
+ wait;
+ end process;
+end behav;
diff --git a/testsuite/gna/bug02/repro3.vhdl b/testsuite/gna/bug02/repro3.vhdl
new file mode 100644
index 0000000..31d4892
--- /dev/null
+++ b/testsuite/gna/bug02/repro3.vhdl
@@ -0,0 +1,49 @@
+entity repro3 is
+
+end repro3;
+
+package repro3_pkg is
+ procedure inc (a : inout integer);
+ type prot is protected
+ procedure get (a : integer);
+ end protected prot;
+end repro3_pkg;
+
+package body repro3_pkg is
+ procedure inc (a : inout integer) is
+ begin
+ a := a + 1;
+ end inc;
+
+ procedure inc (a : inout time) is
+ begin
+ a := a + 1 ns;
+ end inc;
+
+ type prot is protected body
+ variable v : integer;
+
+ function inc (a : integer) return integer is
+ begin
+ return a + 1;
+ end inc;
+
+ procedure get (a : integer) is
+ begin
+ v := a;
+ end get;
+ end protected body prot;
+
+end repro3_pkg;
+
+use work.repro3_pkg.all;
+architecture behav of repro3 is
+begin -- behav
+ process
+ variable a : integer := 2;
+ begin
+ inc (a);
+ assert a = 3 report "bad value of a";
+ wait;
+ end process;
+end behav;
diff --git a/testsuite/gna/bug02/testsuite.sh b/testsuite/gna/bug02/testsuite.sh
new file mode 100755
index 0000000..1c0e6d3
--- /dev/null
+++ b/testsuite/gna/bug02/testsuite.sh
@@ -0,0 +1,19 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+analyze repro.vhdl
+elab_simulate repro
+
+analyze repro2.vhdl
+elab_simulate repro2
+
+clean
+
+GHDL_STD_FLAGS=--std=08
+analyze repro3.vhdl
+elab_simulate repro3
+
+clean
+
+echo "Test successful"