aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Squirek <squirek@adacore.com>2021-10-29 23:43:38 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2021-11-09 09:44:50 +0000
commit9f24d32cf6ae542f779a309e4b2f6c77fb6af4f7 (patch)
treef59d5c0845e47bd5fa290a33d7d52830e9b815ec
parent686b427ff408de245a84ec90640fcf36011be5ab (diff)
downloadgcc-9f24d32cf6ae542f779a309e4b2f6c77fb6af4f7.zip
gcc-9f24d32cf6ae542f779a309e4b2f6c77fb6af4f7.tar.gz
gcc-9f24d32cf6ae542f779a309e4b2f6c77fb6af4f7.tar.bz2
[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.
-rw-r--r--gcc/ada/exp_util.adb8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index b0ea44a..1bba059 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