From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id EC77A385843B; Tue, 9 Nov 2021 09:47:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EC77A385843B MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-5038] [Ada] Hang on compilation of unit with type extension in body X-Act-Checkin: gcc X-Git-Author: Justin Squirek X-Git-Refname: refs/heads/master X-Git-Oldrev: 686b427ff408de245a84ec90640fcf36011be5ab X-Git-Newrev: 9f24d32cf6ae542f779a309e4b2f6c77fb6af4f7 Message-Id: <20211109094721.EC77A385843B@sourceware.org> Date: Tue, 9 Nov 2021 09:47:21 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Nov 2021 09:47:22 -0000 https://gcc.gnu.org/g:9f24d32cf6ae542f779a309e4b2f6c77fb6af4f7 commit r12-5038-g9f24d32cf6ae542f779a309e4b2f6c77fb6af4f7 Author: Justin Squirek Date: Fri Oct 29 23:43:38 2021 -0400 [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. Diff: --- 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 b0ea44a7f7b..1bba0595741 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