aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2014-02-01 04:43:41 +0100
committerTristan Gingold <tgingold@free.fr>2014-02-01 04:43:41 +0100
commit1df58ba6e882f71a7c5d1a0ec6fcfba01cd02cb9 (patch)
tree44b46c077a2236c273952e9fcc0a7f8a4545ed85 /testsuite/gna
parent65f7250d7f0ddbf916758acd1a91d313e57ca0f1 (diff)
downloadghdl-1df58ba6e882f71a7c5d1a0ec6fcfba01cd02cb9.tar.gz
ghdl-1df58ba6e882f71a7c5d1a0ec6fcfba01cd02cb9.tar.bz2
ghdl-1df58ba6e882f71a7c5d1a0ec6fcfba01cd02cb9.zip
Add ticket9 test.
Diffstat (limited to 'testsuite/gna')
-rwxr-xr-xtestsuite/gna/testsuite.sh3
-rw-r--r--testsuite/gna/ticket9/index_range_test_A.vhd35
-rw-r--r--testsuite/gna/ticket9/index_range_test_B.vhd24
-rw-r--r--testsuite/gna/ticket9/readme.txt68
-rwxr-xr-xtestsuite/gna/ticket9/testsuite.sh13
5 files changed, 142 insertions, 1 deletions
diff --git a/testsuite/gna/testsuite.sh b/testsuite/gna/testsuite.sh
index 48a322f1b..f4240a058 100755
--- a/testsuite/gna/testsuite.sh
+++ b/testsuite/gna/testsuite.sh
@@ -7,10 +7,11 @@
# bugXXX is for bugs reported on https://gna.org/bugs/?group=ghdl
# srXXX is for support reported on https://gna.org/support/?group=ghdl
# debXX is for bugs report on http://bugs.debian.org/
+# ticketXX is from https://sourceforge.net/p/ghdl-updates/tickets/
set -e
-dirs="bug* sr* deb*"
+dirs="bug* sr* deb* ticket*"
failures=""
full=n
diff --git a/testsuite/gna/ticket9/index_range_test_A.vhd b/testsuite/gna/ticket9/index_range_test_A.vhd
new file mode 100644
index 000000000..a17a107a6
--- /dev/null
+++ b/testsuite/gna/ticket9/index_range_test_A.vhd
@@ -0,0 +1,35 @@
+--
+-- indexing testcase "A" derived from gna bug16782
+--
+-- ghdl-0.31-mcode on win32 : indexing off the end of an unconstrained port results in an unhandled exception
+--
+entity comp2 is
+
+ port(a :in bit_vector);
+
+end entity;
+
+architecture arch of comp2 is
+
+ constant DATAPATH : natural := a'length;
+ signal tmp : bit;
+
+begin
+
+ tmp <= a(DATAPATH+3);
+
+end architecture;
+
+
+entity index_range_test_A is end entity;
+
+architecture arch of index_range_test_A is
+
+ constant DATAPATH :natural := 16;
+ signal a :bit_vector(DATAPATH-1 downto 0);
+
+begin
+
+ i_comp: entity work.comp2 port map(a);
+
+end architecture; \ No newline at end of file
diff --git a/testsuite/gna/ticket9/index_range_test_B.vhd b/testsuite/gna/ticket9/index_range_test_B.vhd
new file mode 100644
index 000000000..d28a358bd
--- /dev/null
+++ b/testsuite/gna/ticket9/index_range_test_B.vhd
@@ -0,0 +1,24 @@
+--
+-- indexing testcase "B" derived from gna bug16782
+--
+-- ghdl-0.31-mcode on win32 : indexing off the end of a bit_vector results in an overflow exception message
+--
+
+entity index_range_test_B is
+end entity;
+
+architecture arch of index_range_test_B is
+
+ signal a : bit_vector(15 downto 0);
+ signal tmp : bit;
+ signal i : integer;
+
+ constant DATAPATH : natural := a'length;
+
+begin
+
+ i <= DATAPATH + 3;
+
+ tmp <= a(i);
+
+end architecture; \ No newline at end of file
diff --git a/testsuite/gna/ticket9/readme.txt b/testsuite/gna/ticket9/readme.txt
new file mode 100644
index 000000000..ae5f02c70
--- /dev/null
+++ b/testsuite/gna/ticket9/readme.txt
@@ -0,0 +1,68 @@
+GHDL 0.31-mcode index out of range behavior
+
+---------------------
+Information
+
+GHDL : GHDL-0.31 release source tree
+COMPILER : GNAT 2013
+OS : XP SP3 32 bit
+
+The attached zip file contains two testcases for index out of range.
+
+---------------------
+index_range_test_A.vhd
+
+This test indexes off the end of an unconstrained port of type bit_vector.
+
+This version exits abnormally, with no message, for GHDL-0.31-mcode on Windows:
+
+ C:\brian\jobs\ghdl_test\test_exceptions>ghdl -r index_range_test_A
+
+ This application has requested the Runtime to terminate it in an unusual way.
+ Please contact the application's support team for more information.
+
+In contrast, ghdl-gcc 0.27 prints the offending code line number:
+
+ $ ghdl -r index_range_test_A
+ ./index_range_test_a:error: bound check failure at index_range_test_A.vhd:19
+ ghdl: compilation error
+
+
+The same abnormal exit behavior is seen for ghdl-mcode when running test suite gna/bug16782
+
+---------------------
+index_range_test_B.vhd
+
+This test indexes off the end of a bit_vector signal of static width.
+
+This version exits with an overflow message for GHDL-0.31-mcode:
+
+ C:\brian\jobs\ghdl_test\test_exceptions>ghdl -r index_range_test_B
+ c:\ghdl\ghdl-0.31\bin\ghdl.exe:error: overflow detected
+ c:\ghdl\ghdl-0.31\bin\ghdl.exe:error: simulation failed
+
+
+In contrast, ghdl-gcc 0.27 prints the offending code line number:
+
+ $ ghdl -r index_range_test_B
+ ./index_range_test_b:error: bound check failure at index_range_test_B.vhd:22
+ ./index_range_test_b:error: simulation failed
+ ghdl: compilation error
+
+
+---------------------
+Related ghdl-discuss messages:
+
+https://mail.gna.org/public/ghdl-discuss/2014-01/msg00233.html
+https://mail.gna.org/public/ghdl-discuss/2014-01/msg00237.html
+
+---------------------
+zip file contents:
+
+ readme.txt : this file
+
+ index_range_test_A.vhd
+ index_range_test_A.ghdl-0.31-mcode.win32.log
+
+ index_range_test_B.vhd
+ index_range_test_B.ghdl-0.31-mcode.win32.log
diff --git a/testsuite/gna/ticket9/testsuite.sh b/testsuite/gna/ticket9/testsuite.sh
new file mode 100755
index 000000000..a8cdf9b55
--- /dev/null
+++ b/testsuite/gna/ticket9/testsuite.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+analyze index_range_test_A.vhd
+elab_simulate_failure index_range_test_A
+
+analyze index_range_test_B.vhd
+elab_simulate_failure index_range_test_B
+
+clean
+
+echo "Test successful"