aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-04-18 08:04:13 +0200
committerTristan Gingold <tgingold@free.fr>2020-04-18 08:04:13 +0200
commit304868c00803062cab662d308def9f091305f081 (patch)
treec841965b7aa307ed88feb6b25cb99a165c4d7363
parent74f1fa0f335df82ce6e1909a1f0665b1a459d107 (diff)
downloadghdl-304868c00803062cab662d308def9f091305f081.tar.gz
ghdl-304868c00803062cab662d308def9f091305f081.tar.bz2
ghdl-304868c00803062cab662d308def9f091305f081.zip
testsuite/gna: add a test from #1240
-rw-r--r--testsuite/gna/issue1240/issue1.vhdl12
-rw-r--r--testsuite/gna/issue1240/issue2.vhdl13
-rwxr-xr-xtestsuite/gna/issue1240/testsuite.sh12
3 files changed, 37 insertions, 0 deletions
diff --git a/testsuite/gna/issue1240/issue1.vhdl b/testsuite/gna/issue1240/issue1.vhdl
new file mode 100644
index 000000000..cc5bf9f46
--- /dev/null
+++ b/testsuite/gna/issue1240/issue1.vhdl
@@ -0,0 +1,12 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+entity issue1 is
+ port (foobar : out signed (3 downto 0));
+end issue1;
+
+architecture beh of issue1 is
+begin
+ foobar <= to_signed(natural'(-1), foobar'length);
+end architecture;
diff --git a/testsuite/gna/issue1240/issue2.vhdl b/testsuite/gna/issue1240/issue2.vhdl
new file mode 100644
index 000000000..7e9f9032a
--- /dev/null
+++ b/testsuite/gna/issue1240/issue2.vhdl
@@ -0,0 +1,13 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+entity issue2 is
+ port (foobar : out signed (3 downto 0));
+end issue2;
+
+architecture beh of issue2 is
+ subtype my_type is natural range 0 to 1; -- width = 1
+begin
+ foobar <= to_signed(my_type'(-15), foobar'length);
+end architecture;
diff --git a/testsuite/gna/issue1240/testsuite.sh b/testsuite/gna/issue1240/testsuite.sh
new file mode 100755
index 000000000..602389099
--- /dev/null
+++ b/testsuite/gna/issue1240/testsuite.sh
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+export GHDL_STD_FLAGS=-Werror=runtime-error
+
+analyze_failure issue1.vhdl
+analyze_failure issue2.vhdl
+
+clean
+
+echo "Test successful"