aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2016-02-16 07:49:40 +0100
committerTristan Gingold <tgingold@free.fr>2016-02-17 21:04:46 +0100
commit0cbee4bed82744757cb8c7d556a105441a4d521a (patch)
treed33cd3a29108d625d5283d653b9f1a592693827f /testsuite/gna
parentce97cf3bc4a5732d5aca67acd474add6bd9b167d (diff)
downloadghdl-0cbee4bed82744757cb8c7d556a105441a4d521a.tar.gz
ghdl-0cbee4bed82744757cb8c7d556a105441a4d521a.tar.bz2
ghdl-0cbee4bed82744757cb8c7d556a105441a4d521a.zip
Add testcase for issue42.
Diffstat (limited to 'testsuite/gna')
-rw-r--r--testsuite/gna/issue42/bugreport_attribute.vhdl82
-rwxr-xr-xtestsuite/gna/issue42/testsuite.sh9
2 files changed, 91 insertions, 0 deletions
diff --git a/testsuite/gna/issue42/bugreport_attribute.vhdl b/testsuite/gna/issue42/bugreport_attribute.vhdl
new file mode 100644
index 000000000..a99d11263
--- /dev/null
+++ b/testsuite/gna/issue42/bugreport_attribute.vhdl
@@ -0,0 +1,82 @@
+-- EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*-
+-- vim: tabstop=2:shiftwidth=2:noexpandtab
+-- kate: tab-width 2; replace-tabs off; indent-width 2;
+-- =============================================================================
+-- Authors: Patrick Lehmann
+-- Reproducer: Experiments on custom attributes ended in a crash.
+--
+-- License:
+-- =============================================================================
+-- Copyright 2007-2016 Technische Universitaet Dresden - Germany
+-- Chair for VLSI-Design, Diagnostics and Architecture
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+-- =============================================================================
+--
+-- Issue:
+-- I'm not sure if my experimental code is allowed in VHDL, but it let GHDL
+-- crash. So I'm reporting just an unhandled exception.
+--
+-- GHDL's output is:
+-- .\attribute.vhdl:64:58: can't match 'image attribute with type character
+-- .\attribute.vhdl:64:53: (location of 'image attribute)
+-- finish_sem_name: cannot handle IIR_KIND_OVERLOAD_LIST (??:??:??)
+--
+-- ******************** GHDL Bug occured ****************************
+-- Please report this bug on https://github.com/tgingold/ghdl/issues
+-- GHDL release: GHDL 0.34dev (commit: 2016-02-11; git branch: paebbels/master'; hash: f24fdfb) [Dunoon edition]
+-- Compiled with GNAT Version: GPL 2015 (20150428-49)
+-- In directory: H:\Austausch\PoC\temp\ghdl\
+-- Command line:
+-- C:\Tools\GHDL.new\bin\ghdl.exe -a --std=08 .\attribute.vhdl
+-- Exception TYPES.INTERNAL_ERROR raised
+-- Exception information:
+-- Exception name: TYPES.INTERNAL_ERROR
+-- Message: errorout.adb:66
+-- ******************************************************************
+--
+-- GHDL calls:
+-- PS> ghdl.exe -a --std=93c .\attribute.vhdl
+-- PS> ghdl.exe -a --std=08 .\attribute.vhdl
+--
+library IEEE;
+use IEEE.std_logic_1164.all;
+
+
+entity test is
+end entity;
+
+architecture tb of test is
+ function to_string(slv : STD_LOGIC_VECTOR) return STRING is
+ variable Result : STRING(slv'length - 1 downto 0);
+ begin
+ for i in slv'range loop
+ Result(i + 1) := STD_LOGIC'image(slv(i));
+ end loop;
+ return Result;
+ end function;
+
+ attribute serialize : to_string;
+
+ signal mySignal : STD_LOGIC_VECTOR(7 downto 0);
+ attribute serialize of mySignal : signal is to_string[STD_LOGIC_VECTOR return STRING];
+
+begin
+ mySignal <= x"24";
+
+ process
+ begin
+ report "mySignal=" & mySignal'serialize severity NOTE;
+ wait;
+ end process;
+end architecture;
diff --git a/testsuite/gna/issue42/testsuite.sh b/testsuite/gna/issue42/testsuite.sh
new file mode 100755
index 000000000..8d3973c6b
--- /dev/null
+++ b/testsuite/gna/issue42/testsuite.sh
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+analyze_failure bugreport_attribute.vhdl
+
+clean
+
+echo "Test successful"