aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2015-05-26 21:29:00 +0200
committerTristan Gingold <tgingold@free.fr>2015-05-26 21:29:00 +0200
commitcf93c28809e41da171abfd6a6db5622f27b61e32 (patch)
treef76d9dc8f51afb71b59363ab3c068c2d2a40316a
parent2f1b14b847d87954b76feebd2d8f683e5ce92fd7 (diff)
downloadghdl-cf93c28809e41da171abfd6a6db5622f27b61e32.tar.gz
ghdl-cf93c28809e41da171abfd6a6db5622f27b61e32.tar.bz2
ghdl-cf93c28809e41da171abfd6a6db5622f27b61e32.zip
testcase for ticket81.
-rw-r--r--testsuite/gna/ticket81/bug.vhdl13
-rw-r--r--testsuite/gna/ticket81/repro.vhdl11
-rw-r--r--testsuite/gna/ticket81/repro2.vhdl12
-rwxr-xr-xtestsuite/gna/ticket81/testsuite.sh14
4 files changed, 50 insertions, 0 deletions
diff --git a/testsuite/gna/ticket81/bug.vhdl b/testsuite/gna/ticket81/bug.vhdl
new file mode 100644
index 000000000..f2d76d69c
--- /dev/null
+++ b/testsuite/gna/ticket81/bug.vhdl
@@ -0,0 +1,13 @@
+entity ent is
+end entity;
+
+architecture a of ent is
+begin
+ main : process
+ variable bv : bit_vector(0 to 0);
+ begin
+ report to_string(bv'length); -- Works
+ report to_string(2 * bv'length); -- Does not work
+ wait;
+ end process;
+end architecture;
diff --git a/testsuite/gna/ticket81/repro.vhdl b/testsuite/gna/ticket81/repro.vhdl
new file mode 100644
index 000000000..be0781e72
--- /dev/null
+++ b/testsuite/gna/ticket81/repro.vhdl
@@ -0,0 +1,11 @@
+entity repro is
+end;
+
+architecture behav of repro is
+ function zeros (a, b : bit_vector) return bit_vector is
+ constant res : bit_vector (a'length + b'length - 1 downto 0) := (others => '0');
+ begin
+ return res;
+ end;
+begin
+end behav;
diff --git a/testsuite/gna/ticket81/repro2.vhdl b/testsuite/gna/ticket81/repro2.vhdl
new file mode 100644
index 000000000..9874ac19d
--- /dev/null
+++ b/testsuite/gna/ticket81/repro2.vhdl
@@ -0,0 +1,12 @@
+entity repro2 is
+end;
+
+architecture behav of repro2 is
+ function zeros (a, b : bit_vector) return bit_vector is
+ begin
+ if a'length = 1 then
+ return "0";
+ end if;
+ end;
+begin
+end behav;
diff --git a/testsuite/gna/ticket81/testsuite.sh b/testsuite/gna/ticket81/testsuite.sh
new file mode 100755
index 000000000..f6c976d89
--- /dev/null
+++ b/testsuite/gna/ticket81/testsuite.sh
@@ -0,0 +1,14 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+analyze repro.vhdl
+analyze repro2.vhdl
+clean
+
+GHDL_STD_FLAGS=--std=08
+analyze bug.vhdl
+elab_simulate ent
+clean
+
+echo "Test successful"