diff options
| author | Tristan Gingold <tgingold@free.fr> | 2014-07-18 20:29:28 +0200 | 
|---|---|---|
| committer | Tristan Gingold <tgingold@free.fr> | 2014-07-18 20:29:28 +0200 | 
| commit | 415befa3bfe945bc069fd1ce73d8efd91e3b459f (patch) | |
| tree | 3e3d901d415f99cac031079d0f0671fbf1593717 | |
| parent | caba1d1b21d9756ede50f40d53fbc816d3b84320 (diff) | |
| download | ghdl-415befa3bfe945bc069fd1ce73d8efd91e3b459f.tar.gz ghdl-415befa3bfe945bc069fd1ce73d8efd91e3b459f.tar.bz2 ghdl-415befa3bfe945bc069fd1ce73d8efd91e3b459f.zip | |
Fix implicit conversion in conversion association.
Fix attribute on library units.
| -rw-r--r-- | ieee-vital_timing.adb | 2 | ||||
| -rw-r--r-- | iirs.adb | 3 | ||||
| -rw-r--r-- | iirs.ads | 2 | ||||
| -rw-r--r-- | post_sems.adb | 10 | ||||
| -rw-r--r-- | translate/translation.adb | 40 | 
5 files changed, 31 insertions, 26 deletions
| diff --git a/ieee-vital_timing.adb b/ieee-vital_timing.adb index 72053ebaf..64a03e1b9 100644 --- a/ieee-vital_timing.adb +++ b/ieee-vital_timing.adb @@ -1309,7 +1309,7 @@ package body Ieee.Vital_Timing is        Value : Iir_Attribute_Value;        Spec : Iir_Attribute_Specification;     begin -      Value := Get_Attribute_Value_Chain (Unit); +      Value := Get_Attribute_Value_Chain (Get_Library_Unit (Unit));        while Value /= Null_Iir loop           Spec := Get_Attribute_Specification (Value);           if Get_Attribute_Designator (Spec) = Vital_Level0_Attribute then @@ -1856,8 +1856,7 @@ package body Iirs is     procedure Check_Kind_For_Attribute_Value_Chain (Target : Iir) is     begin        case Get_Kind (Target) is -         when Iir_Kind_Design_Unit -           | Iir_Kind_Type_Declaration +         when Iir_Kind_Type_Declaration             | Iir_Kind_Subtype_Declaration             | Iir_Kind_Nature_Declaration             | Iir_Kind_Subnature_Declaration @@ -146,8 +146,6 @@ package Iirs is     --     --   Get/Set_Identifier (Field3)     -- -   --   Get/Set_Attribute_Value_Chain (Field4) -   --     -- Get/Set the library unit, which can be an entity, an architecture,     -- a package, a package body or a configuration.     --   Get/Set_Library_Unit (Field5) diff --git a/post_sems.adb b/post_sems.adb index 27fafd5df..151be334e 100644 --- a/post_sems.adb +++ b/post_sems.adb @@ -24,7 +24,7 @@ with Flags; use Flags;  package body Post_Sems is     procedure Post_Sem_Checks (Unit : Iir_Design_Unit)     is -      Lib_Unit : Iir; +      Lib_Unit : constant Iir := Get_Library_Unit (Unit);        Lib : Iir_Library_Declaration;        Id : Name_Id; @@ -32,7 +32,11 @@ package body Post_Sems is        Spec : Iir_Attribute_Specification;        Attr_Decl : Iir_Attribute_Declaration;     begin -      Lib_Unit := Get_Library_Unit (Unit); +      --  No checks on package bodies. +      if Get_Kind (Lib_Unit) = Iir_Kind_Package_Body then +         return; +      end if; +        Id := Get_Identifier (Lib_Unit);        Lib := Get_Library (Get_Design_File (Unit)); @@ -49,7 +53,7 @@ package body Post_Sems is        --  Look for VITAL attributes.        if Flag_Vital_Checks then -         Value := Get_Attribute_Value_Chain (Unit); +         Value := Get_Attribute_Value_Chain (Lib_Unit);           while Value /= Null_Iir loop              Spec := Get_Attribute_Specification (Value);              Attr_Decl := Get_Attribute_Designator (Spec); diff --git a/translate/translation.adb b/translate/translation.adb index a80e40ea4..8836281f6 100644 --- a/translate/translation.adb +++ b/translate/translation.adb @@ -11521,9 +11521,11 @@ package body Translation is           Base_Block : Iir;           Entity : Iir)        is +         Formal : constant Iir := Get_Formal (Assoc); +         Actual : constant Iir := Get_Actual (Assoc); +           Mark2, Mark3 : Id_Mark_Type;           Inter_List : O_Inter_List; -         Formal, Actual : Iir;           In_Type, Out_Type : Iir;           In_Info, Out_Info : Type_Info_Acc;           Itype : O_Tnode; @@ -11542,12 +11544,9 @@ package body Translation is           Constr : O_Assoc_List;           Subprg_Info : Subprg_Info_Acc;           Res : Mnode; -         Res_Info : Type_Info_Acc;           Imp : Iir; +         Func : Iir;        begin -         Formal := Get_Formal (Assoc); -         Actual := Get_Actual (Assoc); -           case Mode is              when Conv_Mode_In =>                 --  IN: from actual to formal. @@ -11690,13 +11689,14 @@ package body Translation is           case Get_Kind (Imp) is              when Iir_Kind_Function_Call => -               Imp := Get_Implementation (Imp); +               Func := Get_Implementation (Imp);                 R := Chap7.Translate_Implicit_Conv -                 (R, In_Type, Get_Type (Get_Interface_Declaration_Chain (Imp)), +                 (R, In_Type, +                  Get_Type (Get_Interface_Declaration_Chain (Func)),                    Mode_Value, Assoc);                 --  Create result value. -               Subprg_Info := Get_Info (Imp); +               Subprg_Info := Get_Info (Func);                 if Subprg_Info.Use_Stack2 then                    Create_Temp_Stack2_Mark; @@ -11706,11 +11706,9 @@ package body Translation is                    --  Composite result.                    --  If we need to allocate, do it before starting the call!                    declare -                     Res_Type : Iir; -                     Res_Info : Type_Info_Acc; +                     Res_Type : constant Iir := Get_Return_Type (Func); +                     Res_Info : constant Type_Info_Acc := Get_Info (Res_Type);                    begin -                     Res_Type := Get_Return_Type (Imp); -                     Res_Info := Get_Info (Res_Type);                       Res := Create_Temp (Res_Info);                       if Res_Info.Type_Mode /= Type_Mode_Fat_Array then                          Chap4.Allocate_Complex_Object @@ -11732,23 +11730,29 @@ package body Translation is                 New_Association (Constr, R); -               Res_Info := Get_Info (Get_Return_Type (Imp));                 if Subprg_Info.Res_Interface /= O_Dnode_Null then                    --  Composite result.                    New_Procedure_Call (Constr); +                  E := M2E (Res);                 else -                  Res := E2M (New_Function_Call (Constr), -                              Res_Info, Mode_Value); +                  E := New_Function_Call (Constr);                 end if; +               Res := E2M +                 (Chap7.Translate_Implicit_Conv +                    (E, Get_Return_Type (Func), +                     Out_Type, Mode_Value, Imp), +                  Get_Info (Out_Type), Mode_Value);              when Iir_Kind_Type_Conversion =>                 declare                    Conv_Type : Iir;                 begin                    Conv_Type := Get_Type (Imp); -                  Res := E2M (Chap7.Translate_Type_Conversion -                              (R, In_Type, Conv_Type, Assoc), -                              Get_Info (Conv_Type), Mode_Value); +                  E := Chap7.Translate_Type_Conversion +                    (R, In_Type, Conv_Type, Assoc); +                  E := Chap7.Translate_Implicit_Conv +                    (E, Conv_Type, Out_Type, Mode_Value, Imp); +                  Res := E2M (E, Get_Info (Out_Type), Mode_Value);                 end;              when others => | 
