The following patch is a lazy attempt at reporting current_pass when ICEing as for example the backtraces are not exactly helpful in locating the problem when the ICE occurs during the verification phase.
Tested with a forced ICE which now looks like: t.c: In function ?fn1?: cc1: note: executing pass `ssa' t.c:14:1: internal compiler error: in verify_ssa, at tree-ssa.c:939 we can't emit the note after the ICE (because the emitting a DK_ICE diagnostic will already terminate the compiler). Not otherwise tested. Comments? (of course this is to shift the blame faster without having to reproduce a bug...) Thanks, Richard. 2014-11-07 Richard Biener <rguent...@suse.de> * diagnostic.c: Include tree-pass.h. (internal_error): Report pass we are executing currently. Index: gcc/diagnostic.c =================================================================== --- gcc/diagnostic.c (revision 217214) +++ gcc/diagnostic.c (working copy) @@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. #include "backtrace.h" #include "diagnostic.h" #include "diagnostic-color.h" +#include "tree-pass.h" // for current_pass #include <new> // For placement new. @@ -1173,6 +1174,9 @@ internal_error (const char *gmsgid, ...) diagnostic_info diagnostic; va_list ap; + if (current_pass && current_pass->name) + inform (UNKNOWN_LOCATION, "executing pass `%s'", current_pass->name); + va_start (ap, gmsgid); diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_ICE); report_diagnostic (&diagnostic);