aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-07-16 08:38:56 +0200
committerTristan Gingold <tgingold@free.fr>2022-07-16 08:38:56 +0200
commitb11ff2745c951f5beaa8e0eb06dd367a9341f18d (patch)
tree68296b14709923c794f7e7e2ca2297c196539d3c /testsuite
parentcfd13a0983b26c984444a7d2759ac577d2aa1d74 (diff)
downloadghdl-b11ff2745c951f5beaa8e0eb06dd367a9341f18d.tar.gz
ghdl-b11ff2745c951f5beaa8e0eb06dd367a9341f18d.tar.bz2
ghdl-b11ff2745c951f5beaa8e0eb06dd367a9341f18d.zip
testsuite/gna: add a test for #2134
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/gna/issue2134/attribute_on_shared_variable.vhdl28
-rw-r--r--testsuite/gna/issue2134/repro1.vhdl22
-rwxr-xr-xtestsuite/gna/issue2134/testsuite.sh11
3 files changed, 61 insertions, 0 deletions
diff --git a/testsuite/gna/issue2134/attribute_on_shared_variable.vhdl b/testsuite/gna/issue2134/attribute_on_shared_variable.vhdl
new file mode 100644
index 000000000..7fe18cff2
--- /dev/null
+++ b/testsuite/gna/issue2134/attribute_on_shared_variable.vhdl
@@ -0,0 +1,28 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+package attribute_on_shared_variable is
+
+ type protected_t is protected
+ impure function some_function return natural;
+ end protected;
+
+end package;
+
+package body attribute_on_shared_variable is
+
+ type protected_t is protected body
+ variable i : integer;
+ impure function some_function return natural is
+ begin
+ return i;
+ end function;
+ end protected body;
+
+ shared variable si : protected_t;
+
+ attribute some_value : integer;
+ attribute some_value of si : variable is si.some_function;
+
+end package body;
diff --git a/testsuite/gna/issue2134/repro1.vhdl b/testsuite/gna/issue2134/repro1.vhdl
new file mode 100644
index 000000000..0e4943295
--- /dev/null
+++ b/testsuite/gna/issue2134/repro1.vhdl
@@ -0,0 +1,22 @@
+entity repro1 is
+end;
+
+architecture behav of repro1 is
+ type protected_t is protected
+ impure function some_function return natural;
+ end protected;
+
+ type protected_t is protected body
+ variable i : integer;
+ impure function some_function return natural is
+ begin
+ return i;
+ end function;
+ end protected body;
+
+ shared variable si : protected_t;
+
+ attribute some_value : integer;
+ attribute some_value of si : variable is 1;
+begin
+end behav;
diff --git a/testsuite/gna/issue2134/testsuite.sh b/testsuite/gna/issue2134/testsuite.sh
new file mode 100755
index 000000000..db82efecf
--- /dev/null
+++ b/testsuite/gna/issue2134/testsuite.sh
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+export GHDL_STD_FLAGS=--std=08
+analyze repro1.vhdl
+analyze attribute_on_shared_variable.vhdl
+
+clean
+
+echo "Test successful"