diff options
-rw-r--r-- | testsuite/gna/bug02/repro.vhdl | 29 | ||||
-rw-r--r-- | testsuite/gna/bug02/repro2.vhdl | 45 | ||||
-rw-r--r-- | testsuite/gna/bug02/repro3.vhdl | 49 | ||||
-rwxr-xr-x | testsuite/gna/bug02/testsuite.sh | 19 | ||||
-rw-r--r-- | testsuite/testenv.sh | 22 |
5 files changed, 154 insertions, 10 deletions
diff --git a/testsuite/gna/bug02/repro.vhdl b/testsuite/gna/bug02/repro.vhdl new file mode 100644 index 0000000..317d6c4 --- /dev/null +++ b/testsuite/gna/bug02/repro.vhdl @@ -0,0 +1,29 @@ +entity repro is + +end repro; + +architecture behav of repro is + function inc (a : integer) return integer is + begin + return a + 1; + end inc; + + function inc (a : time) return time is + begin + return a + 1 ns; + end inc; + + procedure inc (a : inout integer) is + begin + a := inc (a); + end inc; +begin -- behav + + process + variable a : integer := 2; + begin + inc (a); + assert a = 3 report "bad value of a"; + wait; + end process; +end behav; diff --git a/testsuite/gna/bug02/repro2.vhdl b/testsuite/gna/bug02/repro2.vhdl new file mode 100644 index 0000000..fa6a2f3 --- /dev/null +++ b/testsuite/gna/bug02/repro2.vhdl @@ -0,0 +1,45 @@ +entity repro2 is + +end repro2; + +package repro2_pkg is + procedure inc (a : inout integer); + procedure inc (a : inout time); +end repro2_pkg; + +package body repro2_pkg is + impure function inc (a : integer) return integer is + begin + return a + 1; + end inc; + + procedure inc (a : inout integer) is + begin + a := a + 1; + end inc; + + procedure inc (a : inout time) is + begin + a := a + 1 ns; + end inc; + + type t is (enum1, inc); + + impure function inc (a : time) return time is + begin + return a + 1 ns; + end inc; + +end repro2_pkg; + +use work.repro2_pkg.all; +architecture behav of repro2 is +begin -- behav + process + variable a : integer := 2; + begin + inc (a); + assert a = 3 report "bad value of a"; + wait; + end process; +end behav; diff --git a/testsuite/gna/bug02/repro3.vhdl b/testsuite/gna/bug02/repro3.vhdl new file mode 100644 index 0000000..31d4892 --- /dev/null +++ b/testsuite/gna/bug02/repro3.vhdl @@ -0,0 +1,49 @@ +entity repro3 is + +end repro3; + +package repro3_pkg is + procedure inc (a : inout integer); + type prot is protected + procedure get (a : integer); + end protected prot; +end repro3_pkg; + +package body repro3_pkg is + procedure inc (a : inout integer) is + begin + a := a + 1; + end inc; + + procedure inc (a : inout time) is + begin + a := a + 1 ns; + end inc; + + type prot is protected body + variable v : integer; + + function inc (a : integer) return integer is + begin + return a + 1; + end inc; + + procedure get (a : integer) is + begin + v := a; + end get; + end protected body prot; + +end repro3_pkg; + +use work.repro3_pkg.all; +architecture behav of repro3 is +begin -- behav + process + variable a : integer := 2; + begin + inc (a); + assert a = 3 report "bad value of a"; + wait; + end process; +end behav; diff --git a/testsuite/gna/bug02/testsuite.sh b/testsuite/gna/bug02/testsuite.sh new file mode 100755 index 0000000..1c0e6d3 --- /dev/null +++ b/testsuite/gna/bug02/testsuite.sh @@ -0,0 +1,19 @@ +#! /bin/sh + +. ../../testenv.sh + +analyze repro.vhdl +elab_simulate repro + +analyze repro2.vhdl +elab_simulate repro2 + +clean + +GHDL_STD_FLAGS=--std=08 +analyze repro3.vhdl +elab_simulate repro3 + +clean + +echo "Test successful" diff --git a/testsuite/testenv.sh b/testsuite/testenv.sh index ef8f862..18ea18f 100644 --- a/testsuite/testenv.sh +++ b/testsuite/testenv.sh @@ -9,6 +9,7 @@ # User defined variables (can be set to run the testsuite in some # configuration, such as optimization or debugging): +# GHDL_STD_FLAG # GHDL_FLAGS # GHDL_ELABFLAGS # GHDL_SIMFLAGS @@ -25,7 +26,7 @@ set -e analyze () { echo "analyze $@" - $GHDL -a $GHDL_FLAGS $@ + $GHDL -a $GHDL_STD_FLAGS $GHDL_FLAGS $@ } # Analyze files (failure expected) @@ -33,7 +34,7 @@ analyze_failure () { echo "try to analyze $@" # for arg in $@; do echo "arg: $arg"; done - if ! $GHDL -a --expect-failure $GHDL_FLAGS $@ ; then + if ! $GHDL -a --expect-failure $GHDL_STD_FLAGS $GHDL_FLAGS $@ ; then echo "Failure expected" return 1 fi @@ -44,7 +45,7 @@ analyze_failure () elab () { echo "elaborate $@" - $GHDL -e $GHDL_FLAGS $GHDL_ELABFLAGS $@ + $GHDL -e $GHDL_STD_FLAGS $GHDL_FLAGS $GHDL_ELABFLAGS $@ } # Elaborate a design (failure expected) @@ -52,7 +53,7 @@ elab () elab_failure () { echo "elaborate (failure expected) $@" - $GHDL -e --expect-failure $GHDL_FLAGS $GHDL_ELABFLAGS $@ + $GHDL -e --expect-failure $GHDL_STD_FLAGS $GHDL_FLAGS $GHDL_ELABFLAGS $@ } # Simulate a design (no error expected) @@ -60,7 +61,7 @@ elab_failure () simulate () { echo "simulate $@ ($GHDL_FLAGS $@ $GHDL_SIMFLAGS)" >&2 - $GHDL -r $GHDL_FLAGS $@ $GHDL_SIMFLAGS + $GHDL -r $GHDL_STD_FLAGS $GHDL_FLAGS $@ $GHDL_SIMFLAGS #./$@ } @@ -69,7 +70,7 @@ simulate () simulate_failure () { echo "simulate (failure expected) $@" >&2 - $GHDL -r $GHDL_FLAGS $@ --expect-failure + $GHDL -r $GHDL_STD_FLAGS $GHDL_FLAGS $@ --expect-failure #./$@ } @@ -77,14 +78,15 @@ simulate_failure () elab_simulate () { echo "elaborate and simulate $@" - $GHDL --elab-run $GHDL_FLAGS $GHDL_ELABFLAGS $@ + $GHDL --elab-run $GHDL_STD_FLAGS $GHDL_FLAGS $GHDL_ELABFLAGS $@ } # Elaborate and simulate a design (failure expected) elab_simulate_failure () { echo "elaborate and simulate (failure expected) $@" - $GHDL --elab-run $GHDL_FLAGS $GHDL_ELABFLAGS $@ --expect-failure + $GHDL --elab-run $GHDL_STD_FLAGS $GHDL_FLAGS $GHDL_ELABFLAGS \ + $@ --expect-failure } # Run a program @@ -109,9 +111,9 @@ clean () { if [ $# -eq 0 ]; then echo "Remove work library" - $GHDL --remove + $GHDL --remove $GHDL_STD_FLAGS else echo "Remove $1 library" - $GHDL --remove --work=$1 + $GHDL --remove $GHDL_STD_FLAGS --work=$1 fi } |