From 9f24d32cf6ae542f779a309e4b2f6c77fb6af4f7 Mon Sep 17 00:00:00 2001 From: Justin Squirek Date: Fri, 29 Oct 2021 23:43:38 -0400 Subject: [PATCH] [Ada] Hang on compilation of unit with type extension in body 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 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index b0ea44a7f7b7..1bba0595741e 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -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 -- 2.47.2