From e18db47d92bb735f782e4409abb77d7b9233672f Mon Sep 17 00:00:00 2001
From: Tristan Gingold <tgingold@free.fr>
Date: Thu, 22 Jan 2015 05:09:37 +0100
Subject: Add bug09 testcase on time<->univ_integer conversions.

---
 testsuite/gna/bug09/testsuite.sh | 13 +++++++++++++
 testsuite/gna/bug09/univ1.vhdl   | 22 ++++++++++++++++++++++
 testsuite/gna/bug09/univ2.vhdl   | 17 +++++++++++++++++
 3 files changed, 52 insertions(+)
 create mode 100755 testsuite/gna/bug09/testsuite.sh
 create mode 100644 testsuite/gna/bug09/univ1.vhdl
 create mode 100644 testsuite/gna/bug09/univ2.vhdl

diff --git a/testsuite/gna/bug09/testsuite.sh b/testsuite/gna/bug09/testsuite.sh
new file mode 100755
index 000000000..8d98967e6
--- /dev/null
+++ b/testsuite/gna/bug09/testsuite.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+analyze univ1.vhdl
+elab_simulate_failure univ1
+
+analyze univ2.vhdl
+elab_simulate univ2
+
+clean
+
+echo "Test successful"
diff --git a/testsuite/gna/bug09/univ1.vhdl b/testsuite/gna/bug09/univ1.vhdl
new file mode 100644
index 000000000..dfdc1f80f
--- /dev/null
+++ b/testsuite/gna/bug09/univ1.vhdl
@@ -0,0 +1,22 @@
+entity univ1 is
+end entity;
+
+architecture foo of univ1 is
+    signal i:   integer := Time'POS(Time'High);  -- should produce error
+    
+    -- 6.4.2.3 Signal declarations, para 5, first sentence:
+    -- If the signal declaration includes the assignment symbol followed by an
+    --  expression, it shall be of the same type as the signal. Such an
+    --  expression is said to be a default expression.
+    --
+    -- -1993 4.3.1.2 Signal declarations, para 6, first sentence:
+    -- If the signal declaration includes the assignment symbol followed by
+    --  an expression, it must be of the same type as the signal.
+    
+    -- 'POS returns universal integer
+    -- 
+begin
+    assert False 
+    report "i = " & integer'IMAGE(i)  -- shows left clipping instead of error
+    severity ERROR;
+end architecture;
\ No newline at end of file
diff --git a/testsuite/gna/bug09/univ2.vhdl b/testsuite/gna/bug09/univ2.vhdl
new file mode 100644
index 000000000..af19d38e3
--- /dev/null
+++ b/testsuite/gna/bug09/univ2.vhdl
@@ -0,0 +1,17 @@
+
+entity univ2 is
+end entity;
+
+architecture foo of univ2 is
+
+begin
+    assert False 
+    report "Time'HIGH = " & Time'IMAGE(Time'VAL(Time'POS(Time'HIGH)))
+    severity NOTE;
+    assert False
+    report "should produce 9223372036854775807"
+    severity NOTE;
+end architecture;
+
+-- 'POS returns universal integer
+--  'VAL parameter is any integer type (including universal integer)
\ No newline at end of file
-- 
cgit v1.2.3