[Ada] Fix recent regression on _Master declaration
gcc/ada/ * exp_ch9.adb (Build_Class_Wide_Master): Insert the declaration of _Master before its use; required to avoid assertion failure in the backend.
This commit is contained in:
parent
eafbde5131
commit
d387808d8b
@ -1215,10 +1215,21 @@ package body Exp_Ch9 is
|
|||||||
if not Has_Master_Entity (Master_Scope)
|
if not Has_Master_Entity (Master_Scope)
|
||||||
or else No (Current_Entity_In_Scope (Name_Id))
|
or else No (Current_Entity_In_Scope (Name_Id))
|
||||||
then
|
then
|
||||||
|
declare
|
||||||
|
Ins_Nod : Node_Id;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Set_Has_Master_Entity (Master_Scope);
|
Set_Has_Master_Entity (Master_Scope);
|
||||||
Master_Decl := Build_Master_Declaration (Loc);
|
Master_Decl := Build_Master_Declaration (Loc);
|
||||||
Insert_Action (Find_Hook_Context (Related_Node), Master_Decl);
|
|
||||||
|
-- Ensure that the master declaration is placed before its use
|
||||||
|
|
||||||
|
Ins_Nod := Find_Hook_Context (Related_Node);
|
||||||
|
while not Is_List_Member (Ins_Nod) loop
|
||||||
|
Ins_Nod := Parent (Ins_Nod);
|
||||||
|
end loop;
|
||||||
|
|
||||||
|
Insert_Before (First (List_Containing (Ins_Nod)), Master_Decl);
|
||||||
Analyze (Master_Decl);
|
Analyze (Master_Decl);
|
||||||
|
|
||||||
-- Mark the containing scope as a task master. Masters associated
|
-- Mark the containing scope as a task master. Masters associated
|
||||||
|
Loading…
x
Reference in New Issue
Block a user