summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-15 08:37:21 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-15 08:37:21 +0000
commit216db6e5e86affd4b62e3c9c9fadbb461b78ab13 (patch)
tree971ee2e5a6f70cb1ad95879ad77ee5c2f2c3b28a
parentb3a6bae777111a70c65beff6946a75b7bf3b718b (diff)
downloadgcc-216db6e5e86affd4b62e3c9c9fadbb461b78ab13.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146081 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/sem_ch3.adb12
2 files changed, 18 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 10d2f78be8c..d6b4fa813e5 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -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
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 70d6ceb4077..620be02a315 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -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;