From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id D07053858417; Tue, 9 Nov 2021 09:47:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D07053858417 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-5037] [Ada] Crash on expansion of tagged membership test X-Act-Checkin: gcc X-Git-Author: Justin Squirek X-Git-Refname: refs/heads/master X-Git-Oldrev: d235950e83965ed6389eb94b1cffb7393dcb1984 X-Git-Newrev: 686b427ff408de245a84ec90640fcf36011be5ab Message-Id: <20211109094716.D07053858417@sourceware.org> Date: Tue, 9 Nov 2021 09:47:16 +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:16 -0000 https://gcc.gnu.org/g:686b427ff408de245a84ec90640fcf36011be5ab commit r12-5037-g686b427ff408de245a84ec90640fcf36011be5ab Author: Justin Squirek Date: Fri Oct 29 16:40:17 2021 -0400 [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. Diff: --- gcc/ada/exp_ch4.adb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 3db43dd870a..f3923e914d7 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).