[Ada] Assert failure on incorrect code
[gcc.git] / gcc / ada / lib-xref.adb
index ac59ccc094f6ee3c7eb11f4c65c80077ff73e623..ae4b4c7b744ce463f3ecccd742ed127ba67f6d9e 100644 (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