From d917a68d6e4583e634557d651194d1abea850b61 Mon Sep 17 00:00:00 2001 From: Steve Baird Date: Tue, 30 Aug 2022 16:04:02 -0700 Subject: [PATCH] [Ada] Internal error compiling formal instance of generic with Initial_Condition Prevent the compiler from failing with an internal error in some cases involving an instance of a generic which takes as a formal parameter an instance of a second generic, where the second generic has an Initial_Condition aspect specification. gcc/ada/ * contracts.adb (Analyze_Package_Contract): Do not analyze the contract of a temporary package created just to check conformance of an actual package. --- gcc/ada/contracts.adb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb index 3f85ebc94606..46c9511ca36c 100644 --- a/gcc/ada/contracts.adb +++ b/gcc/ada/contracts.adb @@ -1319,6 +1319,18 @@ package body Contracts is if Present (Items) then if Analyzed (Items) then return; + + -- Do not analyze the contract of the internal package + -- created to check conformance of an actual package. + -- Such an internal package is removed from the tree after + -- legality checks are completed, and it does not contain + -- the declarations of all local entities of the generic. + + elsif Is_Internal (Pack_Id) + and then Is_Generic_Instance (Pack_Id) + then + return; + else Set_Analyzed (Items); end if; -- 2.47.2