From b11ff2745c951f5beaa8e0eb06dd367a9341f18d Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sat, 16 Jul 2022 08:38:56 +0200 Subject: testsuite/gna: add a test for #2134 --- .../issue2134/attribute_on_shared_variable.vhdl | 28 ++++++++++++++++++++++ testsuite/gna/issue2134/repro1.vhdl | 22 +++++++++++++++++ testsuite/gna/issue2134/testsuite.sh | 11 +++++++++ 3 files changed, 61 insertions(+) create mode 100644 testsuite/gna/issue2134/attribute_on_shared_variable.vhdl create mode 100644 testsuite/gna/issue2134/repro1.vhdl create mode 100755 testsuite/gna/issue2134/testsuite.sh (limited to 'testsuite/gna') 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" -- cgit v1.2.3