diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/vhdl/sem.adb | 11 | ||||
-rw-r--r-- | src/vhdl/sem_expr.adb | 6 | ||||
-rw-r--r-- | src/vhdl/translate/trans-rtis.adb | 40 |
3 files changed, 34 insertions, 23 deletions
diff --git a/src/vhdl/sem.adb b/src/vhdl/sem.adb index 1664d67e1..b89e1f005 100644 --- a/src/vhdl/sem.adb +++ b/src/vhdl/sem.adb @@ -2867,9 +2867,14 @@ package body Sem is -- FIXME: unless the parent is a package declaration library unit, the -- design unit depends on the body. - if Get_Need_Body (Pkg) then - Bod := Libraries.Load_Secondary_Unit - (Get_Design_Unit (Pkg), Null_Identifier, Decl); + if Get_Need_Body (Pkg) and then not Is_Nested_Package (Pkg) then + Bod := Get_Package_Body (Pkg); + if Is_Null (Bod) then + Bod := Libraries.Load_Secondary_Unit + (Get_Design_Unit (Pkg), Null_Identifier, Decl); + else + Bod := Get_Design_Unit (Bod); + end if; if Is_Null (Bod) then Error_Msg_Sem (+Decl, "cannot find package body of %n", +Pkg); else diff --git a/src/vhdl/sem_expr.adb b/src/vhdl/sem_expr.adb index 9807fc24a..545d3937a 100644 --- a/src/vhdl/sem_expr.adb +++ b/src/vhdl/sem_expr.adb @@ -967,8 +967,7 @@ package body Sem_Expr is -- Check purity rules when SUBPRG calls CALLEE. -- Both SUBPRG and CALLEE are subprogram declarations. -- Update purity_state/impure_depth of SUBPRG if it is a procedure. - procedure Sem_Call_Purity_Check (Subprg : Iir; Callee : Iir; Loc : Iir) - is + procedure Sem_Call_Purity_Check (Subprg : Iir; Callee : Iir; Loc : Iir) is begin if Callee = Subprg then return; @@ -991,7 +990,8 @@ package body Sem_Expr is end case; case Get_Kind (Callee) is - when Iir_Kind_Function_Declaration => + when Iir_Kind_Function_Declaration + | Iir_Kind_Interface_Function_Declaration => if Get_Pure_Flag (Callee) then -- Pure functions may be called anywhere. return; diff --git a/src/vhdl/translate/trans-rtis.adb b/src/vhdl/translate/trans-rtis.adb index 77c12a358..672ef9b5b 100644 --- a/src/vhdl/translate/trans-rtis.adb +++ b/src/vhdl/translate/trans-rtis.adb @@ -2302,24 +2302,30 @@ package body Trans.Rtis is | Iir_Kind_Group_Declaration => null; when Iir_Kind_Package_Declaration => - declare - Mark : Id_Mark_Type; - begin - Push_Identifier_Prefix (Mark, Get_Identifier (Decl)); - Generate_Block (Decl, Parent_Rti); - Pop_Identifier_Prefix (Mark); - end; + if Get_Info (Decl) /= null then + -- Do not generate RTIs for untranslated packages. + declare + Mark : Id_Mark_Type; + begin + Push_Identifier_Prefix (Mark, Get_Identifier (Decl)); + Generate_Block (Decl, Parent_Rti); + Pop_Identifier_Prefix (Mark); + end; + end if; when Iir_Kind_Package_Body => - declare - Mark : Id_Mark_Type; - Mark1 : Id_Mark_Type; - begin - Push_Identifier_Prefix (Mark, Get_Identifier (Decl)); - Push_Identifier_Prefix (Mark1, "BODY"); - Generate_Block (Decl, Parent_Rti); - Pop_Identifier_Prefix (Mark1); - Pop_Identifier_Prefix (Mark); - end; + if Get_Info (Get_Package (Decl)) /= null then + -- Do not generate RTIs for untranslated packages. + declare + Mark : Id_Mark_Type; + Mark1 : Id_Mark_Type; + begin + Push_Identifier_Prefix (Mark, Get_Identifier (Decl)); + Push_Identifier_Prefix (Mark1, "BODY"); + Generate_Block (Decl, Parent_Rti); + Pop_Identifier_Prefix (Mark1); + Pop_Identifier_Prefix (Mark); + end; + end if; when Iir_Kind_Package_Instantiation_Declaration => -- FIXME: todo |