aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue216
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/gna/issue216')
-rw-r--r--testsuite/gna/issue216/repro1.vhdl16
-rw-r--r--testsuite/gna/issue216/repro2.vhdl11
-rw-r--r--testsuite/gna/issue216/repro3.vhdl9
-rw-r--r--testsuite/gna/issue216/test.vhdl39
-rwxr-xr-xtestsuite/gna/issue216/testsuite.sh16
5 files changed, 91 insertions, 0 deletions
diff --git a/testsuite/gna/issue216/repro1.vhdl b/testsuite/gna/issue216/repro1.vhdl
new file mode 100644
index 000000000..173f123d1
--- /dev/null
+++ b/testsuite/gna/issue216/repro1.vhdl
@@ -0,0 +1,16 @@
+entity repro1 is
+ generic (c : natural := 4);
+end repro1;
+
+architecture behav of repro1 is
+ constant cmap : string (1 to 5) :=
+ (1 => 'a', 2 => 'b', 3 => 'c', 4 => 'd', 5 => 'e');
+begin
+ process
+ variable v : character;
+ begin
+ v := cmap (c);
+ assert v = 'd' report "bad value" severity error;
+ wait;
+ end process;
+end behav;
diff --git a/testsuite/gna/issue216/repro2.vhdl b/testsuite/gna/issue216/repro2.vhdl
new file mode 100644
index 000000000..9e2a7fc91
--- /dev/null
+++ b/testsuite/gna/issue216/repro2.vhdl
@@ -0,0 +1,11 @@
+entity repro2 is
+end repro2;
+
+architecture behav of repro2 is
+ constant c : natural := 2;
+ constant cmap : string (1 to 5) :=
+ (1 => 'a', 2 => 'b', 3 => 'c', 4 => 'd', 5 => 'e');
+begin
+ assert cmap (c) = 'b';
+ assert cmap & 'f' = "abcdef";
+end behav;
diff --git a/testsuite/gna/issue216/repro3.vhdl b/testsuite/gna/issue216/repro3.vhdl
new file mode 100644
index 000000000..59e1c8009
--- /dev/null
+++ b/testsuite/gna/issue216/repro3.vhdl
@@ -0,0 +1,9 @@
+entity repro3 is
+end repro3;
+
+architecture behav of repro3 is
+ constant c : character := 'e';
+ constant cond : boolean := c /= 'a';
+begin
+ assert cond;
+end behav;
diff --git a/testsuite/gna/issue216/test.vhdl b/testsuite/gna/issue216/test.vhdl
new file mode 100644
index 000000000..e0b69887f
--- /dev/null
+++ b/testsuite/gna/issue216/test.vhdl
@@ -0,0 +1,39 @@
+ENTITY test IS
+END ENTITY test;
+
+ARCHITECTURE rtl OF test IS
+
+ TYPE test_type_t IS (
+ TEST_1,
+ TEST_2);
+
+ TYPE test_type_value_t IS ARRAY (test_type_t) OF natural;
+
+ CONSTANT C_TEST_TYPE_VALUE : test_type_value_t := (
+ TEST_1 => 0,
+ TEST_2 => 1);
+
+ CONSTANT C_TEST_TYPE_TEST_1 : natural := C_TEST_TYPE_VALUE(TEST_1);
+ CONSTANT C_TEST_TYPE_TEST_2 : natural := C_TEST_TYPE_VALUE(TEST_2);
+
+ FUNCTION get_priority (
+ arg : natural)
+ RETURN natural IS
+ VARIABLE result_v : natural;
+ BEGIN
+ CASE arg IS
+ WHEN C_TEST_TYPE_TEST_1 =>
+ result_v := 3;
+ WHEN C_TEST_TYPE_TEST_2 =>
+ result_v := 0;
+ WHEN OTHERS =>
+ REPORT "Unknown Sector Type"
+ SEVERITY error;
+ result_v := 4;
+ END CASE;
+ RETURN result_v;
+ END FUNCTION get_priority;
+
+BEGIN
+
+END ARCHITECTURE rtl;
diff --git a/testsuite/gna/issue216/testsuite.sh b/testsuite/gna/issue216/testsuite.sh
new file mode 100755
index 000000000..44259a783
--- /dev/null
+++ b/testsuite/gna/issue216/testsuite.sh
@@ -0,0 +1,16 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+export GHDL_STD_FLAGS=--std=08
+analyze test.vhdl
+elab_simulate test
+
+analyze repro1.vhdl
+elab_simulate repro1
+
+analyze repro2.vhdl
+analyze repro3.vhdl
+clean
+
+echo "Test successful"