diff options
author | Jakub Jelinek <jakub@redhat.com> | 2015-01-23 09:51:10 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2015-01-23 09:51:10 +0100 |
commit | b55f40c12246309f204e2eccbe5d659641e841c9 (patch) | |
tree | dddeb957b58b9b0f7e1d3254194afaf71ebeb8f6 /gcc | |
parent | 652960d1809b326ad20adcaac1b5a72796413a2e (diff) | |
download | gcc-b55f40c12246309f204e2eccbe5d659641e841c9.zip gcc-b55f40c12246309f204e2eccbe5d659641e841c9.tar.gz gcc-b55f40c12246309f204e2eccbe5d659641e841c9.tar.bz2 |
diagnostic-core.h (internal_error_no_backtrace): New prototype.
* diagnostic-core.h (internal_error_no_backtrace): New prototype.
* diagnostic.def (DK_ICE_NOBT): New kind.
* diagnostic.c (diagnostic_action_after_output): Handle DK_ICE_NOBT
like DK_ICE, but never print backtrace.
(diagnostic_report_diagnostic): Handle DK_ICE_NOBT like DK_ICE.
(internal_error_no_backtrace): New function.
* gcc.c (execute): Use internal_error_no_backtrace instead of
internal_error.
fortran/
* gfc-diagnostic.def (DK_ICE_NOBT): New kind.
From-SVN: r220030
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/diagnostic-core.h | 2 | ||||
-rw-r--r-- | gcc/diagnostic.c | 28 | ||||
-rw-r--r-- | gcc/diagnostic.def | 3 | ||||
-rw-r--r-- | gcc/fortran/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/fortran/gfc-diagnostic.def | 3 | ||||
-rw-r--r-- | gcc/gcc.c | 5 |
7 files changed, 50 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ae5e9a5..4a1cfcf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2015-01-23 Jakub Jelinek <jakub@redhat.com> + + * diagnostic-core.h (internal_error_no_backtrace): New prototype. + * diagnostic.def (DK_ICE_NOBT): New kind. + * diagnostic.c (diagnostic_action_after_output): Handle DK_ICE_NOBT + like DK_ICE, but never print backtrace. + (diagnostic_report_diagnostic): Handle DK_ICE_NOBT like DK_ICE. + (internal_error_no_backtrace): New function. + * gcc.c (execute): Use internal_error_no_backtrace instead of + internal_error. + 2015-01-22 Jeff Law <law@redhat.com> PR target/52076 diff --git a/gcc/diagnostic-core.h b/gcc/diagnostic-core.h index 01e866b..d97111d 100644 --- a/gcc/diagnostic-core.h +++ b/gcc/diagnostic-core.h @@ -56,6 +56,8 @@ extern const char *trim_filename (const char *); #endif extern void internal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2) ATTRIBUTE_NORETURN; +extern void internal_error_no_backtrace (const char *, ...) + ATTRIBUTE_GCC_DIAG(1,2) ATTRIBUTE_NORETURN; /* Pass one of the OPT_W* from options.h as the first parameter. */ extern bool warning (int, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); extern bool warning_n (location_t, int, int, const char *, const char *, ...) diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 6b4da23..33eed3e 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -518,9 +518,11 @@ diagnostic_action_after_output (diagnostic_context *context, break; case DK_ICE: + case DK_ICE_NOBT: { - struct backtrace_state *state = - backtrace_create_state (NULL, 0, bt_err_callback, NULL); + struct backtrace_state *state = NULL; + if (diag_kind == DK_ICE) + state = backtrace_create_state (NULL, 0, bt_err_callback, NULL); int count = 0; if (state != NULL) backtrace_full (state, 2, bt_callback, bt_err_callback, @@ -739,7 +741,8 @@ diagnostic_report_diagnostic (diagnostic_context *context, /* If we're reporting an ICE in the middle of some other error, try to flush out the previous error, then let this one through. Don't do this more than once. */ - if (diagnostic->kind == DK_ICE && context->lock == 1) + if ((diagnostic->kind == DK_ICE || diagnostic->kind == DK_ICE_NOBT) + && context->lock == 1) pp_newline_and_flush (context->printer); else error_recursion (context); @@ -812,7 +815,7 @@ diagnostic_report_diagnostic (diagnostic_context *context, context->lock++; - if (diagnostic->kind == DK_ICE) + if (diagnostic->kind == DK_ICE || diagnostic->kind == DK_ICE_NOBT) { #ifndef ENABLE_CHECKING /* When not checking, ICEs are converted to fatal errors when an @@ -1239,6 +1242,23 @@ internal_error (const char *gmsgid, ...) gcc_unreachable (); } + +/* Like internal_error, but no backtrace will be printed. Used when + the internal error does not happen at the current location, but happened + somewhere else. */ +void +internal_error_no_backtrace (const char *gmsgid, ...) +{ + diagnostic_info diagnostic; + va_list ap; + + va_start (ap, gmsgid); + diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_ICE_NOBT); + report_diagnostic (&diagnostic); + va_end (ap); + + gcc_unreachable (); +} /* Special case error functions. Most are implemented in terms of the above, or should be. */ diff --git a/gcc/diagnostic.def b/gcc/diagnostic.def index 44aea4c..b90ca69 100644 --- a/gcc/diagnostic.def +++ b/gcc/diagnostic.def @@ -45,3 +45,6 @@ DEFINE_DIAGNOSTIC_KIND (DK_PERMERROR, "permerror: ", NULL) /* This one is just for counting DK_WARNING promoted to DK_ERROR due to -Werror and -Werror=warning. */ DEFINE_DIAGNOSTIC_KIND (DK_WERROR, "error: ", NULL) +/* This is like DK_ICE, but backtrace is not printed. Used in the driver + when reporting fatal signal in the compiler. */ +DEFINE_DIAGNOSTIC_KIND (DK_ICE_NOBT, "internal compiler error: ", "error") diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 0695b22..6b30eb2 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,7 @@ +2015-01-23 Jakub Jelinek <jakub@redhat.com> + + * gfc-diagnostic.def (DK_ICE_NOBT): New kind. + 2015-01-23 Janus Weil <janus@gcc.gnu.org> PR fortran/60922 diff --git a/gcc/fortran/gfc-diagnostic.def b/gcc/fortran/gfc-diagnostic.def index 2a651c9..f46d273 100644 --- a/gcc/fortran/gfc-diagnostic.def +++ b/gcc/fortran/gfc-diagnostic.def @@ -45,3 +45,6 @@ DEFINE_DIAGNOSTIC_KIND (DK_PERMERROR, "permerror", NULL) /* This one is just for counting DK_WARNING promoted to DK_ERROR due to -Werror and -Werror=warning. */ DEFINE_DIAGNOSTIC_KIND (DK_WERROR, "error", NULL) +/* This is like DK_ICE, but backtrace is not printed. Used in the driver + when reporting fatal signal in the compiler. */ +DEFINE_DIAGNOSTIC_KIND (DK_ICE_NOBT, "internal compiler error", "error") @@ -2912,8 +2912,9 @@ execute (void) } else #endif - internal_error ("%s (program %s)", - strsignal (WTERMSIG (status)), commands[i].prog); + internal_error_no_backtrace ("%s (program %s)", + strsignal (WTERMSIG (status)), + commands[i].prog); } else if (WIFEXITED (status) && WEXITSTATUS (status) >= MIN_FATAL_STATUS) |