From: Arnaud Charlet Date: Tue, 23 Jun 2020 07:56:34 +0000 (-0400) Subject: [Ada] Assert failure on incorrect code X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cc53bec460f003c34dab20063f1cdd006dd160fb;p=gcc.git [Ada] Assert failure on incorrect code gcc/ada/ * sem_ch12.adb (Reset_Entity): Protect against malformed tree. --- 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));