aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2014-01-01 23:59:31 +0100
committerTristan Gingold <tgingold@free.fr>2014-01-01 23:59:31 +0100
commit34d14ac4930ba9bcd4bb6d26e5995f5bd21a5e61 (patch)
treebf2bf6c7c6d753b59d38805584bfb340fb99e3cd /testsuite
parent740acce08938abb6c93b062b47650a8cbce61f01 (diff)
downloadghdl-34d14ac4930ba9bcd4bb6d26e5995f5bd21a5e61.tar.gz
ghdl-34d14ac4930ba9bcd4bb6d26e5995f5bd21a5e61.tar.bz2
ghdl-34d14ac4930ba9bcd4bb6d26e5995f5bd21a5e61.zip
Add bug16782.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/gna/bug16782/bug.vhd36
-rwxr-xr-xtestsuite/gna/bug16782/testsuite.sh10
2 files changed, 46 insertions, 0 deletions
diff --git a/testsuite/gna/bug16782/bug.vhd b/testsuite/gna/bug16782/bug.vhd
new file mode 100644
index 000000000..93d219295
--- /dev/null
+++ b/testsuite/gna/bug16782/bug.vhd
@@ -0,0 +1,36 @@
+entity bug is end entity;
+architecture arch of bug is
+ component comp is port(a :in bit_vector); end component;
+ constant DATAPATH :natural := 16;
+ signal a :bit_vector(DATAPATH-1 downto 0);
+begin
+ i_comp: comp port map(a);
+end architecture;
+
+entity comp is port(a :in bit_vector); end entity;
+architecture arch of comp is
+ constant DATAPATH :natural := a'length;
+ signal state :natural;
+ signal tmp :bit_vector(31 downto 0);
+begin
+ process(a) begin
+ case DATAPATH is
+ when 8=>
+ case state is
+ when 0=> tmp(1*DATAPATH-1 downto 0*DATAPATH)<=a;
+ when 1=> tmp(2*DATAPATH-1 downto 1*DATAPATH)<=a;
+-- When DATAPATH>10 this range violates bounds, but this code should not be reached because "case DATAPATH is when 8=>"
+ when 2=> tmp(3*DATAPATH-1 downto 2*DATAPATH)<=a;
+ when 3=> tmp(4*DATAPATH-1 downto 3*DATAPATH)<=a;
+ when others=>
+ end case;
+ when 16=>
+ case state is
+ when 0=> tmp(1*DATAPATH-1 downto 0*DATAPATH)<=a;
+ when 1=> tmp(2*DATAPATH-1 downto 1*DATAPATH)<=a;
+ when others=>
+ end case;
+ when others=>
+ end case;
+ end process;
+end architecture;
diff --git a/testsuite/gna/bug16782/testsuite.sh b/testsuite/gna/bug16782/testsuite.sh
new file mode 100755
index 000000000..2e2473fe7
--- /dev/null
+++ b/testsuite/gna/bug16782/testsuite.sh
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+analyze bug.vhd
+elab_simulate_failure bug
+
+clean
+
+echo "Test successful"