From cf93c28809e41da171abfd6a6db5622f27b61e32 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 26 May 2015 21:29:00 +0200 Subject: testcase for ticket81. --- testsuite/gna/ticket81/bug.vhdl | 13 +++++++++++++ testsuite/gna/ticket81/repro.vhdl | 11 +++++++++++ testsuite/gna/ticket81/repro2.vhdl | 12 ++++++++++++ testsuite/gna/ticket81/testsuite.sh | 14 ++++++++++++++ 4 files changed, 50 insertions(+) create mode 100644 testsuite/gna/ticket81/bug.vhdl create mode 100644 testsuite/gna/ticket81/repro.vhdl create mode 100644 testsuite/gna/ticket81/repro2.vhdl create mode 100755 testsuite/gna/ticket81/testsuite.sh (limited to 'testsuite') 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" -- cgit v1.2.3