Local variables in a function are created new each function call. Also note your sequential assignments of med and result don't imply a clock delay between them the value of med is updated immediately. While your simulation might work it doesn't synchronize.
You could try a procedure:
library ieee;
use ieee.std_logic_1164.all;
entity foo is
end entity;
architecture fum of foo is
procedure sync (
signal clk: in std_logic;
signal a: in std_logic;
signal med: inout std_logic;
signal result: inout std_logic
) is
begin
if clk'event and clk = '1' then
med <= a;
result <= med;
end if;
end ;
signal a: std_logic;
signal clk: std_logic := '0';
signal med: std_logic;
signal result: std_logic;
begin
SYNCHRO:
sync (clk,a,med,result);
EVALUATE:
process (result)
begin
if result = '1' then
end if;
end process;
end architecture;
Notice this is the equivalent of using a sync component because a procedure doesn't have a return value, with various restrictions on using signals in a procedure effectively limiting this to one level of hierarchy.
You might as well create a sync component and use and output signal name that's descriptive (e.g. a_sync).