Patch to remove _master of access types across limited with - ytomino/drake GitHub Wiki
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65683.
diff --git gcc/ada/freeze.adb gcc/ada/freeze.adb
index bfee655..459231b 100644
--- gcc/ada/freeze.adb
+++ gcc/ada/freeze.adb
@@ -32,6 +32,7 @@ with Elists; use Elists;
with Errout; use Errout;
with Exp_Ch3; use Exp_Ch3;
with Exp_Ch7; use Exp_Ch7;
+with Exp_Ch9; use Exp_Ch9;
with Exp_Disp; use Exp_Disp;
with Exp_Pakd; use Exp_Pakd;
with Exp_Util; use Exp_Util;
@@ -5637,6 +5638,21 @@ package body Freeze is
Check_Restriction (No_Standard_Storage_Pools, E);
end if;
+ -- If the designated type is a limited view, we cannot tell if
+ -- the full view contains tasks, and there is no way to handle
+ -- that full view in a client. We create a master entity for the
+ -- scope, which will be used when a client determines that one
+ -- is needed.
+
+ if From_Limited_With (E)
+ and then not Is_Class_Wide_Type (E)
+ and then not No_Pool_Assigned (E)
+ and then No (Master_Id (E))
+ then
+ Build_Master_Entity (E);
+ Build_Master_Renaming (E);
+ end if;
+
-- Deal with error message for pure access type. This is not an
-- error in Ada 2005 if there is no pool (see AI-366).
diff --git gcc/ada/sem_ch3.adb gcc/ada/sem_ch3.adb
index 64761f8..c29b812 100644
--- gcc/ada/sem_ch3.adb
+++ gcc/ada/sem_ch3.adb
@@ -1357,20 +1357,6 @@ package body Sem_Ch3 is
if Ekind (Root_Type (Entity (S))) = E_Incomplete_Type then
Set_Directly_Designated_Type (T, Entity (S));
- -- If the designated type is a limited view, we cannot tell if
- -- the full view contains tasks, and there is no way to handle
- -- that full view in a client. We create a master entity for the
- -- scope, which will be used when a client determines that one
- -- is needed.
-
- if From_Limited_With (Entity (S))
- and then not Is_Class_Wide_Type (Entity (S))
- then
- Set_Ekind (T, E_Access_Type);
- Build_Master_Entity (T);
- Build_Master_Renaming (T);
- end if;
-
else
Set_Directly_Designated_Type (T, Process_Subtype (S, P, T, 'P'));
end if;