From 7f8ad8f001a4054e07b7d0762a14a6784bec136c Mon Sep 17 00:00:00 2001 From: Ed Schonberg Date: Fri, 13 Dec 2019 09:04:06 +0000 Subject: [PATCH] [Ada] Crash on inherited private operation in child package 2019-12-13 Ed Schonberg gcc/ada/ * sem_ch7.adb (Analyze_Package_Body_Helper): Do not call Declare_Inherited_Private_Subprograms on s child body: the required operations have already been created when analyzing the corresponding package declaration. This prevents a redeclaration of inehrited operation, and a crash when inserting the new operation in the current scope. From-SVN: r279349 --- gcc/ada/ChangeLog | 9 +++++++++ gcc/ada/sem_ch7.adb | 3 +++ 2 files changed, 12 insertions(+) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 598b2016085..1da3ebc97ff 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,12 @@ +2019-12-13 Ed Schonberg + + * sem_ch7.adb (Analyze_Package_Body_Helper): Do not call + Declare_Inherited_Private_Subprograms on s child body: the + required operations have already been created when analyzing the + corresponding package declaration. This prevents a redeclaration + of inehrited operation, and a crash when inserting the new + operation in the current scope. + 2019-12-13 Yannick Moy * sem_prag.adb (Analyze_Depends_In_Decl_Part, diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb index 313cb4eaaa3..6d9a1db5b7e 100644 --- a/gcc/ada/sem_ch7.adb +++ b/gcc/ada/sem_ch7.adb @@ -925,9 +925,12 @@ package body Sem_Ch7 is -- This is a nested package, so it may be necessary to declare certain -- inherited subprograms that are not yet visible because the parent -- type's subprograms are now visible. + -- Note that for child units these operations were generated when + -- analyzing the package specification. if Ekind (Scope (Spec_Id)) = E_Package and then Scope (Spec_Id) /= Standard_Standard + and then not Is_Child_Unit (Spec_Id) then Declare_Inherited_Private_Subprograms (Spec_Id); end if; -- 2.30.2