]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Hang on compilation of unit with type extension in body
authorJustin Squirek <squirek@adacore.com>
Sat, 30 Oct 2021 03:43:38 +0000 (23:43 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 9 Nov 2021 09:44:50 +0000 (09:44 +0000)
gcc/ada/

* exp_util.adb (Ancestor_Primitive): Prevent return of an
subprogram alias when the ancestor primitive of the alias is the
same as Subp.

gcc/ada/exp_util.adb

index b0ea44a7f7b7786a8a00fdfd89314b75cdf19909..1bba0595741e215175d3b85fe396c8753d331cce 100644 (file)
@@ -10433,6 +10433,14 @@ package body Exp_Util is
          --  inherited ancestor primitive.
 
          elsif Present (Inher_Prim) then
+            --  It is possible that an internally generated alias could be
+            --  set to a subprogram which overrides the same aliased primitive,
+            --  so return Empty in this case.
+
+            if Ancestor_Primitive (Inher_Prim) = Subp then
+               return Empty;
+            end if;
+
             return Inher_Prim;
 
          --  Otherwise the current subprogram is the root of the inheritance or