aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJustin Squirek <squirek@adacore.com>2021-06-15 12:54:12 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2021-07-09 12:35:31 +0000
commit66d43665bc9c8a8f38531a8b9a02cfcfe129cc88 (patch)
tree667648dda07754ddf96745e636fc3b581257f5b3 /gcc
parent79b87fcf29cd100f15ae68bd74bf94830bf41564 (diff)
downloadgcc-66d43665bc9c8a8f38531a8b9a02cfcfe129cc88.zip
gcc-66d43665bc9c8a8f38531a8b9a02cfcfe129cc88.tar.gz
gcc-66d43665bc9c8a8f38531a8b9a02cfcfe129cc88.tar.bz2
[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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/exp_ch6.adb9
1 files changed, 9 insertions, 0 deletions
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