diff options
Diffstat (limited to 'testsuite/gna')
-rw-r--r-- | testsuite/gna/issue1381/repro.vhdl | 21 | ||||
-rw-r--r-- | testsuite/gna/issue1381/repro2.vhdl | 28 | ||||
-rw-r--r-- | testsuite/gna/issue1381/repro3.vhdl | 14 | ||||
-rw-r--r-- | testsuite/gna/issue1381/repro4.vhdl | 14 | ||||
-rwxr-xr-x | testsuite/gna/issue1381/testsuite.sh | 12 |
5 files changed, 89 insertions, 0 deletions
diff --git a/testsuite/gna/issue1381/repro.vhdl b/testsuite/gna/issue1381/repro.vhdl new file mode 100644 index 000000000..af3c550fa --- /dev/null +++ b/testsuite/gna/issue1381/repro.vhdl @@ -0,0 +1,21 @@ +entity repro is +end; + +architecture behav of repro is + type id_arr is array(bit) of bit; + + constant idc : id_arr := ('0' => '0', '1' => '1'); + + function f(a : bit_vector) return bit_vector + is + variable v : bit_vector(1 to a'length) := a; + variable r : bit_vector(1 to a'length); + begin + for i in v'range loop + r(i) := idc(v (i)); + end loop; + return r; + end f; +begin + assert f("01") = "01"; +end behav; diff --git a/testsuite/gna/issue1381/repro2.vhdl b/testsuite/gna/issue1381/repro2.vhdl new file mode 100644 index 000000000..a3347df3f --- /dev/null +++ b/testsuite/gna/issue1381/repro2.vhdl @@ -0,0 +1,28 @@ +entity repro2 is + port (o : out bit); +end; + +architecture behav of repro2 is + function idf (a : bit) return bit is + begin + return a; + end idf; + + type id_arr is array(bit) of bit; + + constant idc : id_arr := ('0' => '0', '1' => '1'); + + function f(a : bit_vector) return bit_vector + is + variable v : bit_vector(1 to a'length) := a; + variable r : bit_vector(1 to a'length); + begin + for i in v'range loop + r(i) := idc(v (i)); + end loop; + return r; + end f; +begin + assert f("01") = "01"; + assert idc(o) = '1'; +end behav; diff --git a/testsuite/gna/issue1381/repro3.vhdl b/testsuite/gna/issue1381/repro3.vhdl new file mode 100644 index 000000000..4ff3449ff --- /dev/null +++ b/testsuite/gna/issue1381/repro3.vhdl @@ -0,0 +1,14 @@ +entity repro3 is + port (n : out natural); +end; + +architecture behav of repro3 is + impure function f(a : bit_vector) return bit_vector + is + subtype st is natural range 1 to n; + begin + return a; + end f; +begin + assert f("01") = "01"; +end behav; diff --git a/testsuite/gna/issue1381/repro4.vhdl b/testsuite/gna/issue1381/repro4.vhdl new file mode 100644 index 000000000..9a54e4027 --- /dev/null +++ b/testsuite/gna/issue1381/repro4.vhdl @@ -0,0 +1,14 @@ +entity repro4 is +end; + +architecture behav of repro4 is + impure function f(a : bit_vector) return bit_vector + is + variable n : natural := 2; + subtype st is natural range 1 to n; + begin + return a; + end f; +begin + assert f("01") = "01"; +end behav; diff --git a/testsuite/gna/issue1381/testsuite.sh b/testsuite/gna/issue1381/testsuite.sh new file mode 100755 index 000000000..10388ef94 --- /dev/null +++ b/testsuite/gna/issue1381/testsuite.sh @@ -0,0 +1,12 @@ +#! /bin/sh + +. ../../testenv.sh + +analyze -Wunused -Werror repro.vhdl +analyze_failure repro2.vhdl +analyze_failure repro3.vhdl +analyze -Wunused -Werror repro4.vhdl + +clean + +echo "Test successful" |