From f07792aec9c4e943978f8212e2a0f6e870294dbf Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 17 May 2021 19:20:56 +0200 Subject: testsuite/gna: add a test for #1768 --- testsuite/gna/issue1768/repro.vhdl | 25 +++++++++++++++++++++++++ testsuite/gna/issue1768/repro2.vhdl | 22 ++++++++++++++++++++++ testsuite/gna/issue1768/repro3.vhdl | 12 ++++++++++++ testsuite/gna/issue1768/testsuite.sh | 11 +++++++++++ 4 files changed, 70 insertions(+) create mode 100644 testsuite/gna/issue1768/repro.vhdl create mode 100644 testsuite/gna/issue1768/repro2.vhdl create mode 100644 testsuite/gna/issue1768/repro3.vhdl create mode 100755 testsuite/gna/issue1768/testsuite.sh (limited to 'testsuite') diff --git a/testsuite/gna/issue1768/repro.vhdl b/testsuite/gna/issue1768/repro.vhdl new file mode 100644 index 000000000..2d2dda374 --- /dev/null +++ b/testsuite/gna/issue1768/repro.vhdl @@ -0,0 +1,25 @@ +package pkg is + function log2 (v : positive) return natural; +end pkg; + +package body pkg is + function log2 (v : positive) return natural is + begin + return 2; + end log2; +end pkg; + +use work.pkg.all; + +package repro is + constant W : natural := 8; + function f (vec : bit_vector(log2(W / 2) - 1 downto 0)) return bit; +end repro; + +package body repro is + function f (vec : bit_vector(log2(W / 2) - 1 downto 0)) return bit is + begin + return '1'; + end f; +end repro; + diff --git a/testsuite/gna/issue1768/repro2.vhdl b/testsuite/gna/issue1768/repro2.vhdl new file mode 100644 index 000000000..e2e9f15cc --- /dev/null +++ b/testsuite/gna/issue1768/repro2.vhdl @@ -0,0 +1,22 @@ +package pkg2 is + type natural_array is array (positive range <>) of natural; + constant log2 : natural_array := (1 => 0, + 2 => 1, + 3 to 4 => 2, + 5 to 8 => 3); +end pkg2; + +use work.pkg2.all; + +package repro2 is + constant W : natural := 8; + function f (vec : bit_vector(log2(W / 2) - 1 downto 0)) return bit; +end repro2; + +package body repro2 is + function f (vec : bit_vector(log2(W / 2) - 1 downto 0)) return bit is + begin + return '1'; + end f; +end repro2; + diff --git a/testsuite/gna/issue1768/repro3.vhdl b/testsuite/gna/issue1768/repro3.vhdl new file mode 100644 index 000000000..7c64f4c67 --- /dev/null +++ b/testsuite/gna/issue1768/repro3.vhdl @@ -0,0 +1,12 @@ +package repro3 is + constant bv : bit_vector := "1010011"; + function f (vec : bit_vector := bv (0 to 3)) return bit; +end repro3; + +package body repro3 is + function f (vec : bit_vector := bv (0 to 3)) return bit is + begin + return '1'; + end f; +end repro3; + diff --git a/testsuite/gna/issue1768/testsuite.sh b/testsuite/gna/issue1768/testsuite.sh new file mode 100755 index 000000000..3ce439f6f --- /dev/null +++ b/testsuite/gna/issue1768/testsuite.sh @@ -0,0 +1,11 @@ +#! /bin/sh + +. ../../testenv.sh + +analyze repro.vhdl +analyze repro2.vhdl +analyze repro3.vhdl + +clean + +echo "Test successful" -- cgit v1.2.3