aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2016-10-12 10:40:37 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2016-10-12 12:40:37 +0200
commit5b4c1029596a33d420738c3ef7bc547edd924321 (patch)
tree90499528cfce1e195217265d6f4a61a1c019db29
parent05662a060a8b17e077c58ce1867fcecf82bd31ff (diff)
downloadgcc-5b4c1029596a33d420738c3ef7bc547edd924321.zip
gcc-5b4c1029596a33d420738c3ef7bc547edd924321.tar.gz
gcc-5b4c1029596a33d420738c3ef7bc547edd924321.tar.bz2
sem_ch12.adb (Check_Formal_Package_Instance): Skip an internal formal entity without a parent only if...
2016-10-12 Ed Schonberg <schonberg@adacore.com> * sem_ch12.adb (Check_Formal_Package_Instance): Skip an internal formal entity without a parent only if the corresponding actual entity has a different kind. * exp_ch9.adb (Build_Class_Wide_Master): If the master is declared locally, insert the renaming declaration after the master declaration, to prevent access before elaboration in gigi. From-SVN: r241029
-rw-r--r--gcc/ada/ChangeLog9
-rw-r--r--gcc/ada/exp_ch9.adb18
-rw-r--r--gcc/ada/sem_ch12.adb2
3 files changed, 24 insertions, 5 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index ad188a7..87a5447 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,14 @@
2016-10-12 Ed Schonberg <schonberg@adacore.com>
+ * sem_ch12.adb (Check_Formal_Package_Instance): Skip an internal
+ formal entity without a parent only if the corresponding actual
+ entity has a different kind.
+ * exp_ch9.adb (Build_Class_Wide_Master): If the master is
+ declared locally, insert the renaming declaration after the
+ master declaration, to prevent access before elaboration in gigi.
+
+2016-10-12 Ed Schonberg <schonberg@adacore.com>
+
* contracts.adb (Analyze_Contracts): For a type declaration, analyze
an iterable aspect when present.
diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb
index 6c572ce..22373dd 100644
--- a/gcc/ada/exp_ch9.adb
+++ b/gcc/ada/exp_ch9.adb
@@ -1107,6 +1107,7 @@ package body Exp_Ch9 is
procedure Build_Class_Wide_Master (Typ : Entity_Id) is
Loc : constant Source_Ptr := Sloc (Typ);
Master_Id : Entity_Id;
+ Master_Decl : Node_Id;
Master_Scope : Entity_Id;
Name_Id : Node_Id;
Related_Node : Node_Id;
@@ -1146,13 +1147,12 @@ package body Exp_Ch9 is
-- the second transient scope requires a _master, it cannot use the one
-- already declared because the entity is not visible.
- Name_Id := Make_Identifier (Loc, Name_uMaster);
+ Name_Id := Make_Identifier (Loc, Name_uMaster);
+ Master_Decl := Empty;
if not Has_Master_Entity (Master_Scope)
or else No (Current_Entity_In_Scope (Name_Id))
then
- declare
- Master_Decl : Node_Id;
begin
Set_Has_Master_Entity (Master_Scope);
@@ -1214,7 +1214,17 @@ package body Exp_Ch9 is
Subtype_Mark => New_Occurrence_Of (Standard_Integer, Loc),
Name => Name_Id);
- Insert_Action (Related_Node, Ren_Decl);
+ -- If the master is declared locally, add the renaming declaration
+ -- immediately after it, to prevent access-before-elaboration in the
+ -- back-end.
+
+ if Present (Master_Decl) then
+ Insert_After (Master_Decl, Ren_Decl);
+ Analyze (Ren_Decl);
+
+ else
+ Insert_Action (Related_Node, Ren_Decl);
+ end if;
Set_Master_Id (Typ, Master_Id);
end Build_Class_Wide_Master;
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index efeaf4f..ed5e948 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -5989,7 +5989,7 @@ package body Sem_Ch12 is
-- itypes and predefined operators (concatenation for arrays, eg).
-- Skip it and keep the formal entity to find a later match for it.
- elsif No (Parent (E2)) then
+ elsif No (Parent (E2)) and then Ekind (E1) /= Ekind (E2) then
E1 := Prev_E1;
goto Next_E;