summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 0000000..f2d76d6
--- /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 0000000..be0781e
--- /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 0000000..9874ac1
--- /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 0000000..f6c976d
--- /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"