From: Justin Squirek Date: Tue, 15 Jun 2021 16:54:12 +0000 (-0400) Subject: [Ada] Crash on expansion of BIP construct in -gnatf mode X-Git-Tag: basepoints/gcc-13~6099 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66d43665bc9c8a8f38531a8b9a02cfcfe129cc88;p=thirdparty%2Fgcc.git [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 --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 1c56cb8b1d59..59704a4065c6 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