From 87011ef06ed381f5716d53222fb68a2ae0863436 Mon Sep 17 00:00:00 2001 From: reichelt Date: Wed, 22 Mar 2006 19:36:22 +0000 Subject: [PATCH] PR driver/22600 * system.h (ICE_EXIT_CODE): New macro. * diagnostic.c (diagnostic_count_diagnostic): Exit with ICE_EXIT_CODE. (diagnostic_action_after_output): Likewise. * gcc.c (fatal_ice): New function. (execute): Use it instead of fatal. (fancy_abort): Likewise. * doc/invoke.texi (-pass-exit-codes): Document return code for ICEs. * fortran/error.c (gfc_fatal_error): Return ICE_EXIT_CODE instead of 4. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112292 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 +++++++++++ gcc/diagnostic.c | 4 ++-- gcc/doc/invoke.texi | 3 ++- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/error.c | 2 +- gcc/gcc.c | 24 ++++++++++++++++++++---- gcc/system.h | 2 ++ 7 files changed, 43 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1d1e5b5bbc4..fe517ce3f04 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2006-03-22 Volker Reichelt + + PR driver/22600 + * system.h (ICE_EXIT_CODE): New macro. + * diagnostic.c (diagnostic_count_diagnostic): Exit with ICE_EXIT_CODE. + (diagnostic_action_after_output): Likewise. + * gcc.c (fatal_ice): New function. + (execute): Use it instead of fatal. + (fancy_abort): Likewise. + * doc/invoke.texi (-pass-exit-codes): Document return code for ICEs. + 2006-03-22 Jeff Law * loop-unroll.c (analyze_iv_to_split_insn): Handle diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index b671b1a38ca..3691477e07b 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -188,7 +188,7 @@ diagnostic_count_diagnostic (diagnostic_context *context, expanded_location s = expand_location (diagnostic->location); fnotice (stderr, "%s:%d: confused by earlier errors, bailing out\n", s.file, s.line); - exit (FATAL_EXIT_CODE); + exit (ICE_EXIT_CODE); } #endif if (context->internal_error) @@ -263,7 +263,7 @@ diagnostic_action_after_output (diagnostic_context *context, fnotice (stderr, "Please submit a full bug report,\n" "with preprocessed source if appropriate.\n" "See %s for instructions.\n", bug_report_url); - exit (FATAL_EXIT_CODE); + exit (ICE_EXIT_CODE); case DK_FATAL: if (context->abort_on_error) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 5b4e8bedcb1..16ec89b7df2 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -957,7 +957,8 @@ Normally the @command{gcc} program will exit with the code of 1 if any phase of the compiler returns a non-success return code. If you specify @option{-pass-exit-codes}, the @command{gcc} program will instead return with numerically highest error produced by any phase that returned an error -indication. +indication. The C, C++, and Fortran frontends return 4, if an internal +compiler error is encountered. @end table If you only want some of the stages of compilation, you can use diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index da2cc081062..e6ce54a3f42 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2006-03-22 Volker Reichelt + + PR driver/22600 + * error.c (gfc_fatal_error): Return ICE_EXIT_CODE instead of 4. + 2006-03-22 Thomas Koenig PR fortran/19303 diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c index 4c82c4a5498..435fc16a36f 100644 --- a/gcc/fortran/error.c +++ b/gcc/fortran/error.c @@ -677,7 +677,7 @@ gfc_internal_error (const char *format, ...) error_print ("", format, argp); va_end (argp); - exit (4); + exit (ICE_EXIT_CODE); } diff --git a/gcc/gcc.c b/gcc/gcc.c index b7e9a1df339..c606773f42e 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -330,6 +330,7 @@ static int default_arg (const char *, int); static void set_multilib_dir (void); static void print_multilib_info (void); static void perror_with_name (const char *); +static void fatal_ice (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; static void notice (const char *, ...) ATTRIBUTE_PRINTF_1; static void display_help (void); static void add_preprocessor_option (const char *, int); @@ -2997,12 +2998,12 @@ execute (void) } else #endif - fatal ("\ + fatal_ice ("\ Internal error: %s (program %s)\n\ Please submit a full bug report.\n\ See %s for instructions.", - strsignal (WTERMSIG (status)), commands[i].prog, - bug_report_url); + strsignal (WTERMSIG (status)), commands[i].prog, + bug_report_url); } else if (WIFEXITED (status) && WEXITSTATUS (status) >= MIN_FATAL_STATUS) @@ -6818,12 +6819,27 @@ perror_with_name (const char *name) void fancy_abort (const char *file, int line, const char *func) { - fatal ("internal gcc abort in %s, at %s:%d", func, file, line); + fatal_ice ("internal gcc abort in %s, at %s:%d", func, file, line); } /* Output an error message and exit. */ void +fatal_ice (const char *cmsgid, ...) +{ + va_list ap; + + va_start (ap, cmsgid); + + fprintf (stderr, "%s: ", programname); + vfprintf (stderr, _(cmsgid), ap); + va_end (ap); + fprintf (stderr, "\n"); + delete_temp_files (); + exit (pass_exit_codes ? ICE_EXIT_CODE : 1); +} + +void fatal (const char *cmsgid, ...) { va_list ap; diff --git a/gcc/system.h b/gcc/system.h index c89394b47cd..4d191e7009d 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -227,6 +227,8 @@ extern int errno; # endif #endif +#define ICE_EXIT_CODE 4 + #ifdef HAVE_UNISTD_H # include #endif -- 2.11.0