diff options
author | Ed Schonberg <schonberg@adacore.com> | 2018-06-11 09:16:43 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2018-06-11 09:16:43 +0000 |
commit | 73dc56ea3dbfabfadbedf32d0a8d332f9d5ad116 (patch) | |
tree | 94ad40094e5f727f935673d28ac3c58196b9b9ba /gcc/ada | |
parent | 4847a76bd2fedb7966b77e595cf27296275c43ba (diff) | |
download | gcc-73dc56ea3dbfabfadbedf32d0a8d332f9d5ad116.zip gcc-73dc56ea3dbfabfadbedf32d0a8d332f9d5ad116.tar.gz gcc-73dc56ea3dbfabfadbedf32d0a8d332f9d5ad116.tar.bz2 |
[Ada] Crash on instantiation of nested generic in private part
This patch fixes a compiler abort on an instantiation of a generic nested
within another instance, when the outer instance is declared in the visible
part of a package and the inner intance is in the private part of the same
package.
2018-06-11 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch12.adb (Install_Body): In order to determine the placement of
the freeze node for an instance of a generic nested within another
instance, take into account that the outer instance may be declared in
the visible part of a package and the inner intance may be in the
private part of the same package.
gcc/testsuite/
* gnat.dg/nested_generic2.adb, gnat.dg/nested_generic2.ads,
gnat.dg/nested_generic2_g1.adb, gnat.dg/nested_generic2_g1.ads,
gnat.dg/nested_generic2_g2.ads: New testcase.
From-SVN: r261398
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/ada/sem_ch12.adb | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 3272499..a2620cf 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2018-06-11 Ed Schonberg <schonberg@adacore.com> + + * sem_ch12.adb (Install_Body): In order to determine the placement of + the freeze node for an instance of a generic nested within another + instance, take into account that the outer instance may be declared in + the visible part of a package and the inner intance may be in the + private part of the same package. + 2018-06-11 Eric Botcazou <ebotcazou@adacore.com> * errout.adb (Special_Msg_Delete): Remove handling of Atomic and VFA. diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 93a1c12..5cc3015 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -9527,9 +9527,13 @@ package body Sem_Ch12 is -- the freeze node for Inst must be inserted after that of -- Parent_Inst. This relation is established by comparing -- the Slocs of Parent_Inst freeze node and Inst. + -- We examine the parents of the enclosing lists to handle + -- the case where the parent instance is in the visible part + -- of a package declaration, and the inner instance is in + -- the corresponding private part. - if List_Containing (Get_Unit_Instantiation_Node (Par)) = - List_Containing (N) + if Parent (List_Containing (Get_Unit_Instantiation_Node (Par))) + = Parent (List_Containing (N)) and then Sloc (Freeze_Node (Par)) < Sloc (N) then Insert_Freeze_Node_For_Instance (N, F_Node); |