diff options
Diffstat (limited to 'testsuite/gna/ticket9')
-rw-r--r-- | testsuite/gna/ticket9/index_range_test_A.vhd | 35 | ||||
-rw-r--r-- | testsuite/gna/ticket9/index_range_test_B.vhd | 24 | ||||
-rw-r--r-- | testsuite/gna/ticket9/readme.txt | 68 | ||||
-rwxr-xr-x | testsuite/gna/ticket9/testsuite.sh | 13 |
4 files changed, 140 insertions, 0 deletions
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 0000000..a17a107 --- /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 0000000..d28a358 --- /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 0000000..ae5f02c --- /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 0000000..a8cdf9b --- /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" |