# DP: Revert: Ada: Fix finalization glitch for pools with subpools
# DP: Breaks the Debian gnat ABI.

--- a/src/gcc/ada/libgnat/s-stposu.adb
+++ b/src/gcc/ada/libgnat/s-stposu.adb
@@ -523,7 +523,6 @@ package body System.Storage_Pools.Subpools is
    procedure Finalize_Pool (Pool : in out Root_Storage_Pool_With_Subpools) is
       Curr_Ptr : SP_Node_Ptr;
       Ex_Occur : Exception_Occurrence;
-      Handle   : Subpool_Handle;
       Raised   : Boolean := False;
 
       function Is_Empty_List (L : not null SP_Node_Ptr) return Boolean;
@@ -558,13 +557,16 @@ package body System.Storage_Pools.Subpools is
       while not Is_Empty_List (Pool.Subpools'Unchecked_Access) loop
          Curr_Ptr := Pool.Subpools.Next;
 
-         --  Finalize and deallocate the subpool. Beware that the node pointed
-         --  to by Curr_Ptr will be deallocated so may not be passed as actual
-         --  in the call, since the formal parameter is In Out.
+         --  Perform the following actions:
+
+         --    1) Finalize all objects chained on the subpool's master
+         --    2) Remove the subpool from the owner's list of subpools
+         --    3) Deallocate the doubly linked list node associated with the
+         --       subpool.
+         --    4) Call Deallocate_Subpool
 
          begin
-            Handle := Curr_Ptr.Subpool;
-            Finalize_And_Deallocate (Handle);
+            Finalize_And_Deallocate (Curr_Ptr.Subpool);
 
          exception
             when Fin_Occur : others =>
