[PATCH] ada: Remove changes to a-tasatt.adb

Samuel Tardieu sam@rfc1149.net
Sun Nov 11 09:26:00 GMT 2007


The latest changes made to a-tasatt.adb caused a bug when the generic
package Ada.Task_Attributes was instantiated in a local context. In
this case, objects identified to be at the top-level when the generic
was instantiated are not anymore at the top-level at instantiation
time (as they are included in the local context from where the
instantiation happens).

I checked in the following patch which reverts parts of my previous
commit changing 'Unchecked_Access into 'Access. The other bits were
fine.

Bootstrapped and tested on i686-pc-linux-gnu.

	* a-tasatt.adb: Revert previous change for this file as it will
	generate an error when this package is instantiated from a
	local context.

diff --git a/gcc/ada/a-tasatt.adb b/gcc/ada/a-tasatt.adb
index cd20591..97e024c 100644
--- a/gcc/ada/a-tasatt.adb
+++ b/gcc/ada/a-tasatt.adb
@@ -415,7 +415,7 @@ package body Ada.Task_Attributes is
             POP.Lock_RTS;
 
             while P /= null loop
-               if P.Instance = Access_Instance'(Local'Access) then
+               if P.Instance = Access_Instance'(Local'Unchecked_Access) then
                   POP.Unlock_RTS;
                   Undefer_Abort (Self_Id);
                   return To_Access_Wrapper (P.Wrapper).Value'Access;
@@ -429,10 +429,11 @@ package body Ada.Task_Attributes is
             --  holding any other lock.
 
             POP.Unlock_RTS;
-            W := new Wrapper'((null, Local'Access, null), Initial_Value);
+            W := new Wrapper'
+                  ((null, Local'Unchecked_Access, null), Initial_Value);
             POP.Lock_RTS;
 
-            P := W.Dummy_Node'Access;
+            P := W.Dummy_Node'Unchecked_Access;
             P.Wrapper := To_Access_Dummy_Wrapper (W);
             P.Next := To_Access_Node (TT.Indirect_Attributes);
             TT.Indirect_Attributes := To_Access_Address (P);
@@ -493,7 +494,7 @@ package body Ada.Task_Attributes is
             Q := To_Access_Node (TT.Indirect_Attributes);
 
             while Q /= null loop
-               if Q.Instance = Access_Instance'(Local'Access) then
+               if Q.Instance = Access_Instance'(Local'Unchecked_Access) then
                   if P = null then
                      TT.Indirect_Attributes := To_Access_Address (Q.Next);
                   else
@@ -580,7 +581,7 @@ package body Ada.Task_Attributes is
 
          while P /= null loop
 
-            if P.Instance = Access_Instance'(Local'Access) then
+            if P.Instance = Access_Instance'(Local'Unchecked_Access) then
                To_Access_Wrapper (P.Wrapper).Value := Val;
                POP.Unlock_RTS;
                Undefer_Abort (Self_Id);
@@ -594,9 +595,9 @@ package body Ada.Task_Attributes is
          --  from using new (i.e the Global_Lock) while holding any other lock.
 
          POP.Unlock_RTS;
-         W := new Wrapper'((null, Local'Access, null), Val);
+         W := new Wrapper'((null, Local'Unchecked_Access, null), Val);
          POP.Lock_RTS;
-         P := W.Dummy_Node'Access;
+         P := W.Dummy_Node'Unchecked_Access;
          P.Wrapper := To_Access_Dummy_Wrapper (W);
          P.Next := To_Access_Node (TT.Indirect_Attributes);
          TT.Indirect_Attributes := To_Access_Address (P);
@@ -668,7 +669,7 @@ package body Ada.Task_Attributes is
          P := To_Access_Node (TT.Indirect_Attributes);
 
          while P /= null loop
-            if P.Instance = Access_Instance'(Local'Access) then
+            if P.Instance = Access_Instance'(Local'Unchecked_Access) then
                Result := To_Access_Wrapper (P.Wrapper).Value;
                POP.Unlock_RTS;
                Undefer_Abort (Self_Id);
@@ -723,7 +724,8 @@ begin
       --  Add this instantiation to the list of all instantiations
 
       Local.Next := System.Tasking.Task_Attributes.All_Attributes;
-      System.Tasking.Task_Attributes.All_Attributes := Local'Access;
+      System.Tasking.Task_Attributes.All_Attributes :=
+        Local'Unchecked_Access;
 
       --  Try to find space for the attribute in the TCB
 



More information about the Gcc-patches mailing list