This patch fixes an issue in the compiler whereby an assignment to a
limited interface access type causes a crash when the right hand side
has an unresolvable function call in prefix notation and verbose errors
are enabled via (-gnatf).

Tested on x86_64-pc-linux-gnu, committed on trunk

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
--- 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


Reply via email to