From: Arnaud Charlet Date: Fri, 19 Jun 2020 13:50:34 +0000 (-0400) Subject: [Ada] Assert failure on incorrect code X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=04c4a5101bb6c18933af3b3c3daf8053660cc1b6;p=gcc.git [Ada] Assert failure on incorrect code gcc/ada/ * lib-xref.adb (Generate_Reference): Protect against malformed tree in case of severe errors. * sem_ch8.adb (Add_Implicit_Operator): Ditto. --- diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb index ac59ccc094f..ae4b4c7b744 100644 --- a/gcc/ada/lib-xref.adb +++ b/gcc/ada/lib-xref.adb @@ -595,7 +595,12 @@ package body Lib.Xref is -- Start of processing for Generate_Reference begin - pragma Assert (Nkind (E) in N_Entity); + -- May happen in case of severe errors + + if Nkind (E) not in N_Entity then + return; + end if; + Find_Actual (N, Formal, Call); if Present (Formal) then diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index b0d91e25a68..3c10a9650c9 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -8212,11 +8212,13 @@ package body Sem_Ch8 is else Add_One_Interp (N, Predef_Op2, T); end if; - else if not Is_Binary_Op then Add_One_Interp (N, Predef_Op, T); - else + + -- Predef_Op2 may be empty in case of previous errors + + elsif Present (Predef_Op2) then Add_One_Interp (N, Predef_Op2, T); end if; end if;