summaryrefslogtreecommitdiff
path: root/gcc/ada/freeze.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2012-07-16 12:26:58 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2012-07-16 12:26:58 +0000
commit1398e76270e9b553b24ce53fe55bcdd4aa988d7e (patch)
tree169785dc0648022f79f9c1abb5d1b9da85e4201b /gcc/ada/freeze.adb
parent0c6c84bafa77d182d6edb272bae83988e35f0bf7 (diff)
downloadgcc-1398e76270e9b553b24ce53fe55bcdd4aa988d7e.tar.gz
2012-07-16 Robert Dewar <dewar@adacore.com>
* a-direct.adb, g-dirope.adb: Minor reformatting. 2012-07-16 Tristan Gingold <gingold@adacore.com> * a-except.ads, a-except-2005.ads: Remove outdated comment. 2012-07-16 Robert Dewar <dewar@adacore.com> * sem_ch6.adb (Subprogram_Name_Greater): Fix algorithm to conform to documentation. 2012-07-16 Ed Schonberg <schonberg@adacore.com> * gnat1drv.adb (Check_Library_Items): Removed, no longer used. 2012-07-16 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Array_Type_Declaration): if component type has invariants, the array type itself requires an invariant procedure. * exp_ch3.ads, exp_ch3.adb (Build_Array_Invariant_Proc): new procedure, to build a checking procedure that applies the invariant check on some type T to each component of an array of T's. Code is similar to the construction of the init_proc for an array, and handles multidimensional arrays by recursing over successive dimensions. 2012-07-16 Hristian Kirtchev <kirtchev@adacore.com> * g-debpoo.adb: Revert previous change. 2012-07-16 Hristian Kirtchev <kirtchev@adacore.com> * freeze.adb (Freeze_Entity): Insert the itype reference to a library-level class-wide subtype after the freeze node of the equivalent record type. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@189526 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/freeze.adb')
-rw-r--r--gcc/ada/freeze.adb39
1 files changed, 25 insertions, 14 deletions
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 7b5ecd9b9be..d9bd91975fc 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -3860,11 +3860,19 @@ package body Freeze is
return Result;
end if;
- -- If the Class_Wide_Type is an Itype (when type is the anonymous
- -- parent of a derived type) and it is a library-level entity,
- -- generate an itype reference for it. Otherwise, its first
- -- explicit reference may be in an inner scope, which will be
- -- rejected by the back-end.
+ -- The equivalent type associated with a class-wide subtype needs
+ -- to be frozen to ensure that its layout is done.
+
+ if Ekind (E) = E_Class_Wide_Subtype
+ and then Present (Equivalent_Type (E))
+ then
+ Freeze_And_Append (Equivalent_Type (E), N, Result);
+ end if;
+
+ -- Generate an itype reference for a library-level class-wide type
+ -- at the freeze point. Otherwise the first explicit reference to
+ -- the type may appear in an inner scope which will be rejected by
+ -- the back-end.
if Is_Itype (E)
and then Is_Compilation_Unit (Scope (E))
@@ -3874,17 +3882,20 @@ package body Freeze is
begin
Set_Itype (Ref, E);
- Add_To_Result (Ref);
- end;
- end if;
- -- The equivalent type associated with a class-wide subtype needs
- -- to be frozen to ensure that its layout is done.
+ -- From a gigi point of view, a class-wide subtype derives
+ -- from its record equivalent type. As a result, the itype
+ -- reference must appear after the freeze node of the
+ -- equivalent type or gigi will reject the reference.
- if Ekind (E) = E_Class_Wide_Subtype
- and then Present (Equivalent_Type (E))
- then
- Freeze_And_Append (Equivalent_Type (E), N, Result);
+ if Ekind (E) = E_Class_Wide_Subtype
+ and then Present (Equivalent_Type (E))
+ then
+ Insert_After (Freeze_Node (Equivalent_Type (E)), Ref);
+ else
+ Add_To_Result (Ref);
+ end if;
+ end;
end if;
-- For a record (sub)type, freeze all the component types (RM