aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@adacore.com>2020-06-23 03:56:34 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2020-10-15 05:39:09 -0400
commitcc53bec460f003c34dab20063f1cdd006dd160fb (patch)
treeb3702b4eb0ae26ccfe32bc404f5b5010bae5d0f9
parent96ece83775334d8125c16c4c3dcc607b511bc7b2 (diff)
downloadgcc-cc53bec460f003c34dab20063f1cdd006dd160fb.zip
gcc-cc53bec460f003c34dab20063f1cdd006dd160fb.tar.gz
gcc-cc53bec460f003c34dab20063f1cdd006dd160fb.tar.bz2
[Ada] Assert failure on incorrect code
gcc/ada/ * sem_ch12.adb (Reset_Entity): Protect against malformed tree.
-rw-r--r--gcc/ada/sem_ch12.adb7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 22e6371..a626eb3 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -15701,7 +15701,12 @@ package body Sem_Ch12 is
elsif Nkind (Parent (N)) = N_Selected_Component
and then Nkind (Parent (N2)) = N_Expanded_Name
then
- if Is_Global (Entity (Parent (N2))) then
+ -- In case of previous errors, the tree might be malformed
+
+ if No (Entity (Parent (N2))) then
+ null;
+
+ elsif Is_Global (Entity (Parent (N2))) then
Change_Selected_Component_To_Expanded_Name (Parent (N));
Set_Associated_Node (Parent (N), Parent (N2));
Set_Global_Type (Parent (N), Parent (N2));