[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.
This commit is contained in:
Arnaud Charlet 2020-06-19 09:50:34 -04:00 committed by Pierre-Marie de Rodat
parent cb030dd735
commit 04c4a5101b
2 changed files with 10 additions and 3 deletions

View File

@ -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

View File

@ -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;