sem_ch3.adb (Analyze_Type_Declaration): Create freeze node for access type even if...
authorEd Schonberg <schonberg@adacore.com>
Wed, 15 Apr 2009 08:37:21 +0000 (08:37 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 15 Apr 2009 08:37:21 +0000 (10:37 +0200)
2009-04-15  Ed Schonberg  <schonberg@adacore.com>

* sem_ch3.adb (Analyze_Type_Declaration): Create freeze node for access
type even if the designated type comes from a limited_with clause, to
ensure that the symbol for the finalization list of the access type is
created.

From-SVN: r146081

gcc/ada/ChangeLog
gcc/ada/sem_ch3.adb

index 10d2f78be8c67a432b5ac6ca2897fcf1d49284f9..d6b4fa813e5c0a11e16e2eb0e79920d57b87e209 100644 (file)
@@ -1,3 +1,10 @@
+2009-04-15  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch3.adb (Analyze_Type_Declaration): Create freeze node for access
+       type even if the designated type comes from a limited_with clause, to
+       ensure that the symbol for the finalization list of the access type is
+       created.
+
 2009-04-10  Robert Dewar  <dewar@adacore.com>
 
        * sem_warn.ads, sem_warn.adb (Check_Low_Bound_Tested): Catch more cases
index 70d6ceb4077c41b0a4789d66cab752c51aa2428e..620be02a3157153e5e9d82d17eb664bad74cd1c7 100644 (file)
@@ -4002,7 +4002,17 @@ package body Sem_Ch3 is
             Set_First_Subtype_Link (Freeze_Node (B), T);
          end if;
 
-         if not From_With_Type (T) then
+         --  A type that is imported through a limited_with clause cannot
+         --  generate any code, and thus need not be frozen. However, an
+         --  access type with an imported designated type needs a finalization
+         --  list, which may be referenced in some other package that has
+         --  non-limited visibility on the designated type. Thus we must
+         --  create the finalization list at the point the access type is
+         --  frozen, to prevent unsatisfied references at link time.
+
+         if not From_With_Type (T)
+           or else Is_Access_Type (T)
+         then
             Set_Has_Delayed_Freeze (T);
          end if;
       end;