aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-02-24 17:28:49 +0100
committerTristan Gingold <tgingold@free.fr>2022-02-24 21:37:10 +0100
commit480451e09ee965dc9868bfab240743dae32265d4 (patch)
tree2ce6fd9950894251ad883410b2a8698a6ca10407
parent26eeee5d480cbec7f08173c73958940aa7da3188 (diff)
downloadghdl-480451e09ee965dc9868bfab240743dae32265d4.tar.gz
ghdl-480451e09ee965dc9868bfab240743dae32265d4.tar.bz2
ghdl-480451e09ee965dc9868bfab240743dae32265d4.zip
testsuite/gna: add a test for #1979
-rw-r--r--testsuite/gna/issue1979/repro.vhdl31
-rwxr-xr-xtestsuite/gna/issue1979/testsuite.sh10
2 files changed, 41 insertions, 0 deletions
diff --git a/testsuite/gna/issue1979/repro.vhdl b/testsuite/gna/issue1979/repro.vhdl
new file mode 100644
index 000000000..012279b1f
--- /dev/null
+++ b/testsuite/gna/issue1979/repro.vhdl
@@ -0,0 +1,31 @@
+package repro_pkg is
+ function "<" (a, b : natural) return bit;
+end repro_pkg;
+
+package body repro_pkg is
+ function "<" (a, b : natural) return bit is
+ begin
+ if boolean'(a < b) then
+ return '1';
+ else
+ return '0';
+ end if;
+ end "<";
+end repro_pkg;
+
+use work.repro_pkg.all;
+entity repro is
+end;
+
+architecture behav of repro is
+ signal n1, n2 : natural;
+begin
+ -- No crash: this is a vhdl expression.
+ -- assert n1 < n2;
+
+ -- No crash: this is an 'or' property
+ -- assert n1 < n2 or n2 < n1;
+
+ -- Crash: this is a vhdl expression
+ assert (n1 < n2) or (n2 < n1);
+end;
diff --git a/testsuite/gna/issue1979/testsuite.sh b/testsuite/gna/issue1979/testsuite.sh
new file mode 100755
index 000000000..7b37332aa
--- /dev/null
+++ b/testsuite/gna/issue1979/testsuite.sh
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+export GHDL_STD_FLAGS=--std=08
+analyze repro.vhdl
+
+clean
+
+echo "Test successful"