From: Arnaud Charlet Date: Fri, 19 Jun 2020 13:50:34 +0000 (-0400) Subject: [Ada] Assert failure on incorrect code X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1ac803a420838ed68132afee8109a7c48c591bb;p=thirdparty%2Fgcc.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 ac59ccc094f6..ae4b4c7b744c 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 b0d91e25a683..3c10a9650c9b 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;