aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/issue1407/repro.vhdl
blob: 1d99bd0fc7907a82cb5efec1e4e141869cb38b81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
library ieee;
use ieee.std_logic_1164.all;

entity repro is
  port (a : std_logic_vector (3 downto 0);
        o : out std_logic_vector (3 downto 0));
end;

architecture behav of repro is
  function cancel (a : std_logic_vector) return std_logic_vector
  is
    variable en : boolean := false;
    variable res : std_logic_vector (a'range);
  begin
    if a'length = 0 then
      en := true;
    end if;
    res := a;
    if en then
      res (7) := '0';
    end if;
    return res;
  end cancel;
begin
  o <= cancel (a);
end behav;