exp_ch7.adb (Find_Final_List): for a type appearing in a with_type clause...
authorEd Schonberg <schonber@gnat.com>
Thu, 11 Oct 2001 23:54:52 +0000 (23:54 +0000)
committerGeert Bosch <bosch@gcc.gnu.org>
Thu, 11 Oct 2001 23:54:52 +0000 (01:54 +0200)
* exp_ch7.adb (Find_Final_List): for a type appearing in a with_type
clause, return the gobal finalization list, for lack of anthing else.

From-SVN: r46210

gcc/ada/ChangeLog
gcc/ada/exp_ch7.adb

index 16ecc43422fc3bf2763b07301214f3ba78e5925a..7e563c5feb4ed7f704d0f4c4df23a0d3076f691d 100644 (file)
@@ -1,3 +1,8 @@
+2001-10-11  Ed Schonberg <schonber@gnat.com>
+
+       * exp_ch7.adb (Find_Final_List): for a type appearing in a with_type 
+       clause, return the gobal finalization list, for lack of anthing else. 
+
 2001-10-11  Ed Schonberg <schonber@gnat.com>
 
        * exp_ch7.adb (Make_Transient_Block): if statement is within 
index 03e83603a1e8f2a7e90137bac3f06ecdb2d58413..825a44d336ac565eb49b67d2630624ed1a9b1d4f 100644 (file)
@@ -1140,14 +1140,21 @@ package body Exp_Ch7 is
 
       --  Case of a dynamically allocated object. The final list is the
       --  corresponding list controller (The next entity in the scope of
-      --  the access type with the right type)
+      --  the access type with the right type). If the type comes from a
+      --  With_Type clause, no controller was created, and we use the
+      --  global chain instead.
 
       elsif Is_Access_Type (E) then
-         return
-           Make_Selected_Component (Loc,
-             Prefix        =>
-               New_Reference_To (Associated_Final_Chain (Base_Type (E)), Loc),
-             Selector_Name => Make_Identifier (Loc, Name_F));
+         if not From_With_Type (E) then
+            return
+              Make_Selected_Component (Loc,
+                Prefix        =>
+                  New_Reference_To
+                    (Associated_Final_Chain (Base_Type (E)), Loc),
+                Selector_Name => Make_Identifier (Loc, Name_F));
+         else
+            return New_Reference_To (RTE (RE_Global_Final_List), Sloc (E));
+         end if;
 
       else
          if Is_Dynamic_Scope (E) then