aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue2147
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-07-28 18:21:05 +0200
committerTristan Gingold <tgingold@free.fr>2022-07-28 18:21:05 +0200
commitdb4e5f25c05abaa2fbd11c02c89fb00441769f84 (patch)
tree43d45b88815b9d4e97f7c7c1a847612782ca470d /testsuite/gna/issue2147
parente9cf8a53e9fee4398f17a3a9a8643bdacad8303a (diff)
downloadghdl-db4e5f25c05abaa2fbd11c02c89fb00441769f84.tar.gz
ghdl-db4e5f25c05abaa2fbd11c02c89fb00441769f84.tar.bz2
ghdl-db4e5f25c05abaa2fbd11c02c89fb00441769f84.zip
testsuite/gna: add a test for #2147
Diffstat (limited to 'testsuite/gna/issue2147')
-rw-r--r--testsuite/gna/issue2147/e.vhdl15
-rw-r--r--testsuite/gna/issue2147/e2.vhdl14
-rwxr-xr-xtestsuite/gna/issue2147/testsuite.sh12
3 files changed, 41 insertions, 0 deletions
diff --git a/testsuite/gna/issue2147/e.vhdl b/testsuite/gna/issue2147/e.vhdl
new file mode 100644
index 000000000..830360370
--- /dev/null
+++ b/testsuite/gna/issue2147/e.vhdl
@@ -0,0 +1,15 @@
+use std.textio.all;
+
+entity e is end;
+
+architecture a of e is
+ function f return line is
+ begin
+ return new string'("");
+ end;
+
+ -- This line causes the crash
+ constant c : bit := f'range;
+begin
+end;
+
diff --git a/testsuite/gna/issue2147/e2.vhdl b/testsuite/gna/issue2147/e2.vhdl
new file mode 100644
index 000000000..d83dadc23
--- /dev/null
+++ b/testsuite/gna/issue2147/e2.vhdl
@@ -0,0 +1,14 @@
+entity e2 is end;
+
+architecture a of e2 is
+ type bv_acc is access bit_vector;
+ function f return bv_acc is
+ begin
+ return new bit_vector'("01");
+ end;
+
+ -- This line causes the crash
+ constant c : bit_vector (f'range) := (others => '0');
+begin
+end;
+
diff --git a/testsuite/gna/issue2147/testsuite.sh b/testsuite/gna/issue2147/testsuite.sh
new file mode 100755
index 000000000..0a66d0a9d
--- /dev/null
+++ b/testsuite/gna/issue2147/testsuite.sh
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+analyze_failure e.vhdl
+
+analyze e2.vhdl
+elab_simulate e2
+
+clean
+
+echo "Test successful"