aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Squirek <squirek@adacore.com>2021-10-29 16:40:17 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2021-11-09 09:44:49 +0000
commit686b427ff408de245a84ec90640fcf36011be5ab (patch)
treece9f7382a0f7759b0681bbf35757f88921f405c4
parentd235950e83965ed6389eb94b1cffb7393dcb1984 (diff)
downloadgcc-686b427ff408de245a84ec90640fcf36011be5ab.zip
gcc-686b427ff408de245a84ec90640fcf36011be5ab.tar.gz
gcc-686b427ff408de245a84ec90640fcf36011be5ab.tar.bz2
[Ada] Crash on expansion of tagged membership test
gcc/ada/ * exp_ch4.adb (Tagged_Membership): Use corresponding record type when expanding a tagged membership test on protected types.
-rw-r--r--gcc/ada/exp_ch4.adb11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 3db43dd..f3923e9 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -15346,6 +15346,17 @@ package body Exp_Ch4 is
begin
SCIL_Node := Empty;
+ -- We have to examine the corresponding record type when dealing with
+ -- protected types instead of the original, unexpanded, type.
+
+ if Ekind (Right_Type) = E_Protected_Type then
+ Right_Type := Corresponding_Record_Type (Right_Type);
+ end if;
+
+ if Ekind (Left_Type) = E_Protected_Type then
+ Left_Type := Corresponding_Record_Type (Left_Type);
+ end if;
+
-- In the case where the type is an access type, the test is applied
-- using the designated types (needed in Ada 2012 for implicit anonymous
-- access conversions, for AI05-0149).