From 66d43665bc9c8a8f38531a8b9a02cfcfe129cc88 Mon Sep 17 00:00:00 2001 From: Justin Squirek Date: Tue, 15 Jun 2021 12:54:12 -0400 Subject: [PATCH] [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. --- 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 1c56cb8..59704a4 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 -- 2.7.4