Skip to content

Commit

Permalink
vhdl-sem_types.adb: refine conditions for resolution functions.
Browse files Browse the repository at this point in the history
Do not consider that functions with unbounded elements can be a
resolution function.

For #1844
  • Loading branch information
tgingold committed Aug 25, 2021
1 parent a5ff9b6 commit 46ffacc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/vhdl/vhdl-sem_types.adb
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,7 @@ package body Vhdl.Sem_Types is
Decl: Iir;
Decl_Type : Iir;
Ret_Type : Iir;
El_Type : Iir;
begin
-- LRM93 2.4
-- A resolution function must be a [pure] function;
Expand Down Expand Up @@ -1343,16 +1344,19 @@ package body Vhdl.Sem_Types is
-- The type of the return value of the function must also be that of
-- the signal.
Ret_Type := Get_Return_Type (Func);
if Get_Base_Type (Get_Element_Subtype (Decl_Type))
/= Get_Base_Type (Ret_Type)
then
El_Type := Get_Element_Subtype (Decl_Type);
if Get_Base_Type (El_Type) /= Get_Base_Type (Ret_Type) then
return False;
end if;
if Atype /= Null_Iir
and then Get_Base_Type (Ret_Type) /= Get_Base_Type (Atype)
then
return False;
end if;
if not Is_Fully_Constrained_Type (El_Type) then
-- FIXME: not yet handled: unbounded element.
return False;
end if;
-- LRM93 2.4
-- A resolution function must be a [pure] function;
if not Flags.Flag_Relaxed_Rules and then not Get_Pure_Flag (Func) then
Expand Down

0 comments on commit 46ffacc

Please sign in to comment.