From 48695e579a7746fe52eda777b14ec10d918e7e4b Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 25 May 2021 08:05:02 +0200 Subject: testsuite/gna: add tests for #1772 --- testsuite/gna/issue1772/repro.vhdl | 23 +++++++++++++++++++++++ testsuite/gna/issue1772/repro2.vhdl | 26 ++++++++++++++++++++++++++ testsuite/gna/issue1772/repro3.vhdl | 16 ++++++++++++++++ testsuite/gna/issue1772/testsuite.sh | 14 ++++++++++++++ 4 files changed, 79 insertions(+) create mode 100644 testsuite/gna/issue1772/repro.vhdl create mode 100644 testsuite/gna/issue1772/repro2.vhdl create mode 100644 testsuite/gna/issue1772/repro3.vhdl create mode 100755 testsuite/gna/issue1772/testsuite.sh diff --git a/testsuite/gna/issue1772/repro.vhdl b/testsuite/gna/issue1772/repro.vhdl new file mode 100644 index 000000000..a427681f6 --- /dev/null +++ b/testsuite/gna/issue1772/repro.vhdl @@ -0,0 +1,23 @@ +entity repro is +end; + +architecture behav of repro is + type arr_el_t is array(0 to 3) of string; + type arr_t is array(integer range <>) of arr_el_t; + + constant cst : arr_t := + (1 => (" ","A0 ","VAL2","ELEMENT_VALUE_3"), + 2 => (" ","10 ","VAL2","ELEMENT_VALUE_3")); +begin + process + begin + for i in cst'range loop + report "cst(" & to_string(i) & "):"; + for j in cst(i)'range loop + report cst(i)(j); + end loop; + end loop; + wait; + end process; +end behav; + diff --git a/testsuite/gna/issue1772/repro2.vhdl b/testsuite/gna/issue1772/repro2.vhdl new file mode 100644 index 000000000..07c28646f --- /dev/null +++ b/testsuite/gna/issue1772/repro2.vhdl @@ -0,0 +1,26 @@ +entity repro2 is +end; + +architecture behav of repro2 is + type arr_el_t is array(0 to 1) of string (1 to 4); + type arr_t is array(integer range <>) of arr_el_t; + + constant cst : arr_t := (1 => ("abcd", "efgh"), + 2 => ("ijkl", "mnop")); +begin + process + begin + for k in arr_el_t'range loop + null; + end loop; + + for i in cst'range loop + report "cst(" & to_string(i) & "):"; + for j in cst'element'range loop + report cst(i)(j); + end loop; + end loop; + wait; + end process; +end behav; + diff --git a/testsuite/gna/issue1772/repro3.vhdl b/testsuite/gna/issue1772/repro3.vhdl new file mode 100644 index 000000000..8355aab51 --- /dev/null +++ b/testsuite/gna/issue1772/repro3.vhdl @@ -0,0 +1,16 @@ +entity repro3 is +end; + +architecture behav of repro3 is + type arr_el_t is array(0 to 1) of string (1 to 4); +begin + process + begin + for k in arr_el_t'range loop + report natural'image (k); + null; + end loop; + wait; + end process; +end behav; + diff --git a/testsuite/gna/issue1772/testsuite.sh b/testsuite/gna/issue1772/testsuite.sh new file mode 100755 index 000000000..8690b18bf --- /dev/null +++ b/testsuite/gna/issue1772/testsuite.sh @@ -0,0 +1,14 @@ +#! /bin/sh + +. ../../testenv.sh + +export GHDL_STD_FLAGS=--std=08 +analyze repro2.vhdl +elab_simulate repro2 + +analyze repro3.vhdl +elab_simulate repro3 + +clean + +echo "Test successful" -- cgit v1.2.3