From cc53bec460f003c34dab20063f1cdd006dd160fb Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 23 Jun 2020 03:56:34 -0400 Subject: [PATCH] [Ada] Assert failure on incorrect code gcc/ada/ * sem_ch12.adb (Reset_Entity): Protect against malformed tree. --- gcc/ada/sem_ch12.adb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 22e6371140a..a626eb3f867 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)); -- 2.30.2