From 45f0ebbbbf65c7147dc6f524234b0fe5b90d56dc Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 7 Jan 2016 19:50:39 +0100 Subject: Add reproducer for issue18. --- testsuite/gna/issue18/fum.vhdl | 55 ++++++++++++++++++++++++++++++++ testsuite/gna/issue18/integer_ambig.vhdl | 15 +++++++++ testsuite/gna/issue18/testsuite.sh | 12 +++++++ 3 files changed, 82 insertions(+) create mode 100644 testsuite/gna/issue18/fum.vhdl create mode 100644 testsuite/gna/issue18/integer_ambig.vhdl create mode 100755 testsuite/gna/issue18/testsuite.sh diff --git a/testsuite/gna/issue18/fum.vhdl b/testsuite/gna/issue18/fum.vhdl new file mode 100644 index 0000000..54ce8c1 --- /dev/null +++ b/testsuite/gna/issue18/fum.vhdl @@ -0,0 +1,55 @@ +package fum is + type fie is protected + impure function foo return integer; + impure function foo(input: real) return integer; -- 4 + impure function foo return integer_vector; + impure function foo (input: real) return integer_vector; -- 6 + impure function foo (input: integer) return integer; + impure function foo(input: integer) return integer_vector; + + end protected fie; +end package; + +package body fum is + type fie is protected body + variable answer: integer := 42; + + impure function foo return integer is + begin + return answer; + end; + + impure function foo(input:real) return integer is + begin + return integer(input) + answer; + end; + + impure function foo return integer_vector is + variable conv_vector: integer_vector (0 to 1); + begin + conv_vector(0) := answer; + conv_vector(1) := 0; + return conv_vector; + end; + + impure function foo (input: real) return integer_vector is + variable conv_vector: integer_vector (0 to 1); + begin + conv_vector(0) := integer(input) + answer; + conv_vector(1) := 0; + end; + + impure function foo (input: integer) return integer is + begin + return answer + input; + end; + + impure function foo(input: integer) return integer_vector is + variable conv_vector: integer_vector (0 to 1); + begin + conv_vector(0) := input + answer; + conv_vector(1) := 0; + return conv_vector; + end; + end protected body fie; +end package body; diff --git a/testsuite/gna/issue18/integer_ambig.vhdl b/testsuite/gna/issue18/integer_ambig.vhdl new file mode 100644 index 0000000..cdf1e0e --- /dev/null +++ b/testsuite/gna/issue18/integer_ambig.vhdl @@ -0,0 +1,15 @@ +use work.fum.all; + +entity overload_index_issue is +end entity overload_index_issue ; +architecture dumbit_down of overload_index_issue is + shared variable fee: fie; +begin + + process + variable Data : integer ; + begin + Data := fee.foo(120.0); + wait; + end process; +end architecture dumbit_down; diff --git a/testsuite/gna/issue18/testsuite.sh b/testsuite/gna/issue18/testsuite.sh new file mode 100755 index 0000000..06323a6 --- /dev/null +++ b/testsuite/gna/issue18/testsuite.sh @@ -0,0 +1,12 @@ +#! /bin/sh + +. ../../testenv.sh + +GHDL_STD_FLAGS=--std=08 +analyze fum.vhdl +analyze integer_ambig.vhdl +elab_simulate overload_index_issue + +clean + +echo "Test successful" -- cgit