From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id A4A863AAB465; Fri, 9 Jul 2021 12:39:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A4A863AAB465 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-2214] [Ada] Crash on expansion of BIP construct in -gnatf mode X-Act-Checkin: gcc X-Git-Author: Justin Squirek X-Git-Refname: refs/heads/master X-Git-Oldrev: 79b87fcf29cd100f15ae68bd74bf94830bf41564 X-Git-Newrev: 66d43665bc9c8a8f38531a8b9a02cfcfe129cc88 Message-Id: <20210709123944.A4A863AAB465@sourceware.org> Date: Fri, 9 Jul 2021 12:39:44 +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: Fri, 09 Jul 2021 12:39:44 -0000 https://gcc.gnu.org/g:66d43665bc9c8a8f38531a8b9a02cfcfe129cc88 commit r12-2214-g66d43665bc9c8a8f38531a8b9a02cfcfe129cc88 Author: Justin Squirek Date: Tue Jun 15 12:54:12 2021 -0400 [Ada] Crash on expansion of BIP construct in -gnatf mode gcc/ada/ * exp_ch6.adb (Is_Build_In_Place_Function_Call): Add check to verify the Selector_Name of Exp_Node has been analyzed before obtaining its entity. Diff: --- gcc/ada/exp_ch6.adb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 1c56cb8b1d5..59704a4065c 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -8275,6 +8275,15 @@ package body Exp_Ch6 is -- This may be a call to a protected function. elsif Nkind (Name (Exp_Node)) = N_Selected_Component then + -- The selector in question might not have been analyzed due to a + -- previous error, so analyze it here to output the appropriate + -- error message instead of crashing when attempting to fetch its + -- entity. + + if not Analyzed (Selector_Name (Name (Exp_Node))) then + Analyze (Selector_Name (Name (Exp_Node))); + end if; + Function_Id := Etype (Entity (Selector_Name (Name (Exp_Node)))); else