aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEd Schonberg <schonber@gnat.com>2001-12-03 18:56:11 +0000
committerGeert Bosch <bosch@gcc.gnu.org>2001-12-03 19:56:11 +0100
commit3bd6c100304455a0240ca776b5c9cd683a0b7ad8 (patch)
tree817c077e4fc55a97321d2b68eb17c09381b5affd /gcc
parent52acbdcba982a18a35bb5309e6812b324f04da79 (diff)
downloadgcc-3bd6c100304455a0240ca776b5c9cd683a0b7ad8.zip
gcc-3bd6c100304455a0240ca776b5c9cd683a0b7ad8.tar.gz
gcc-3bd6c100304455a0240ca776b5c9cd683a0b7ad8.tar.bz2
* sem_ch12.adb:
(Analyze_generic_subprogram_Declaration): Set outer_generic_scope, to prevent freezing within formal packages. (Freeze_Subprogram_Body): If body comes from another instance that appeared before its own body, place freeze node at end of current declarative part, to prevent a back-end crash. (Inline_Instance_Body): Handle properly a package instance within a subprogram instance that is a child unit. From-SVN: r47555
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog11
-rw-r--r--gcc/ada/sem_ch12.adb19
2 files changed, 27 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 25f2598..d3acabe 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,14 @@
+2001-12-03 Ed Schonberg <schonber@gnat.com>
+
+ * sem_ch12.adb:
+ (Analyze_generic_subprogram_Declaration): Set outer_generic_scope,
+ to prevent freezing within formal packages.
+ (Freeze_Subprogram_Body): If body comes from another instance that
+ appeared before its own body, place freeze node at end of current
+ declarative part, to prevent a back-end crash.
+ (Inline_Instance_Body): Handle properly a package instance within
+ a subprogram instance that is a child unit.
+
2001-12-01 Graham Stott <grahams@redhat.com>
* Makefile.in (misc.o): Add missing $(srcdir) prefix
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 481b29d..20af910 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -2061,7 +2061,9 @@ package body Sem_Ch12 is
Enter_Name (Id);
+ Set_Scope_Depth_Value (Id, Scope_Depth (Current_Scope) + 1);
New_Scope (Id);
+ Enter_Generic_Scope (Id);
Set_Inner_Instances (Id, New_Elmt_List);
Set_Is_Pure (Id, Is_Pure (Current_Scope));
@@ -2099,6 +2101,7 @@ package body Sem_Ch12 is
End_Generic;
End_Scope;
+ Exit_Generic_Scope (Id);
end Analyze_Generic_Subprogram_Declaration;
@@ -2715,7 +2718,9 @@ package body Sem_Ch12 is
and then S /= Standard_Standard
loop
exit when Is_Generic_Instance (S)
- and then In_Package_Body (S);
+ and then (In_Package_Body (S)
+ or else Ekind (S) = E_Procedure
+ or else Ekind (S) = E_Function);
if S = Curr_Unit
or else (Ekind (Curr_Unit) = E_Package_Body
@@ -2725,7 +2730,7 @@ package body Sem_Ch12 is
if Is_Child_Unit (S) then
-- Remove child unit from stack, as well as inner scopes.
- -- Removing its context of child unit will remove parent
+ -- Removing the context of a child unit removes parent
-- units as well.
while Current_Scope /= S loop
@@ -5020,7 +5025,15 @@ package body Sem_Ch12 is
and then
In_Same_Declarative_Part (Freeze_Node (Par), Inst_Node)
then
- Insert_After (Freeze_Node (Par), F_Node);
+ if ABE_Is_Certain (Get_Package_Instantiation_Node (Par)) then
+ -- The parent was a premature instantiation. Insert freeze
+ -- node at the end the current declarative part.
+
+ Insert_After_Last_Decl (Inst_Node, F_Node);
+
+ else
+ Insert_After (Freeze_Node (Par), F_Node);
+ end if;
-- The body enclosing the instance should be frozen after the body
-- that includes the generic, because the body of the instance may