From ab5e10334eb99b96f221d9c54474557b496ea841 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sun, 5 Nov 2017 08:38:13 +0100 Subject: Fix duplicate owner in conversion, fix early reference in attribute spec. --- src/vhdl/sem_assocs.adb | 5 +++++ src/vhdl/sem_specs.adb | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/src/vhdl/sem_assocs.adb b/src/vhdl/sem_assocs.adb index a4eee2081..5be583945 100644 --- a/src/vhdl/sem_assocs.adb +++ b/src/vhdl/sem_assocs.adb @@ -1896,6 +1896,9 @@ package body Sem_Assocs is Formal : Iir; Conv_Assoc : Iir; begin + -- Extract formal from the conversion (and unlink it from the + -- conversion, as the owner of the formal is the association, not + -- the conversion). Formal := Finish_Sem_Name (Get_Formal (Assoc)); case Get_Kind (Formal) is when Iir_Kind_Function_Call => @@ -1908,8 +1911,10 @@ package body Sem_Assocs is -- Name_To_Method_Object (Func, Conv); when Iir_Kind_Type_Conversion => pragma Assert (Formal_Conv /= Null_Iir); + Conv_Assoc := Formal; Set_Formal_Conversion (Assoc, Formal); Formal := Get_Expression (Formal); + Set_Expression (Conv_Assoc, Null_Iir); when others => pragma Assert (Formal_Conv = Null_Iir); null; diff --git a/src/vhdl/sem_specs.adb b/src/vhdl/sem_specs.adb index 8d0eb03a8..8c9cd2391 100644 --- a/src/vhdl/sem_specs.adb +++ b/src/vhdl/sem_specs.adb @@ -379,14 +379,23 @@ package body Sem_Specs is -- Note: ENT and DECL are different for aliases. function Sem_Named_Entity1 (Ent : Iir; Decl : Iir) return Boolean is + use Tokens; Ent_Id : constant Name_Id := Get_Identifier (Ent); begin if (not Is_Designator or else Ent_Id = Get_Identifier (Name)) and then Ent_Id /= Null_Identifier then if Is_Designator then + -- The designator is neither ALL nor OTHERS. Set_Named_Entity (Name, Ent); Xref_Ref (Name, Ent); + + if Get_Entity_Class (Attr) = Tok_Label then + -- Concurrent or sequential statements appear later in the + -- AST, but their label are considered to appear before + -- other items in the declarative part. + Set_Is_Forward_Ref (Name, True); + end if; end if; if Get_Visible_Flag (Ent) = False then Error_Msg_Sem (+Attr, "%n is not yet visible", +Ent); -- cgit v1.2.3