]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Internal error compiling formal instance of generic with Initial_Condition
authorSteve Baird <baird@adacore.com>
Tue, 30 Aug 2022 23:04:02 +0000 (16:04 -0700)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 12 Sep 2022 08:16:51 +0000 (10:16 +0200)
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

index 3f85ebc9460637e94c820c7884e5dd589eccc138..46c9511ca36c60c10cf258afa04c5c3dcd51e0a0 100644 (file)
@@ -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;