From b9b90ccedd189fa9814123c7d68689ce21cf8c92 Mon Sep 17 00:00:00 2001 From: zack Date: Tue, 25 Jul 2000 19:01:33 +0000 Subject: [PATCH] * toplev.c (pipe_closed): Delete. (crash_signal): New. Generate ICE for a fatal signal. (float_signal): Call crash_signal outside a float-handler block, not abort. (main): Install crash_signal as handler for core-dumping signals. * cp/decl.c: Remove all signal handling code, now done in toplev.c. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35247 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/cp/ChangeLog | 4 ++++ gcc/cp/decl.c | 54 ------------------------------------------------------ gcc/toplev.c | 36 +++++++++++++++++++++++++++--------- 4 files changed, 39 insertions(+), 63 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d391b95b08e..8c767e1f84e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2000-07-25 Zack Weinberg + + * toplev.c (pipe_closed): Delete. + (crash_signal): New. Generate ICE for a fatal signal. + (float_signal): Call crash_signal outside a float-handler + block, not abort. + (main): Install crash_signal as handler for core-dumping signals. + 2000-07-25 David Edelsohn * rs6000.c (print_operand, case 'T'): New case. diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1c5279960b3..a221131cf53 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2000-07-25 Zack Weinberg + + * decl.c: Remove all signal handling code, now done in toplev.c. + 2000-07-23 Mark Mitchell * decl.c (make_rtl_for_nonlocal_decl): Rework. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index b4e1477b4e4..bd64e2ea441 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -37,7 +37,6 @@ Boston, MA 02111-1307, USA. */ #include "cp-tree.h" #include "decl.h" #include "lex.h" -#include #include "defaults.h" #include "output.h" #include "except.h" @@ -105,7 +104,6 @@ static void suspend_binding_level PARAMS ((void)); static void resume_binding_level PARAMS ((struct binding_level *)); static struct binding_level *make_binding_level PARAMS ((void)); static void declare_namespace_level PARAMS ((void)); -static void signal_catch PARAMS ((int)) ATTRIBUTE_NORETURN; static int decl_jump_unsafe PARAMS ((tree)); static void storedecls PARAMS ((tree)); static void require_complete_types_for_parms PARAMS ((tree)); @@ -6096,36 +6094,6 @@ end_only_namespace_names () only_namespace_names = 0; } -/* Arrange for the user to get a source line number, even when the - compiler is going down in flames, so that she at least has a - chance of working around problems in the compiler. We used to - call error(), but that let the segmentation fault continue - through; now, it's much more passive by asking them to send the - maintainers mail about the problem. */ - -static void -signal_catch (sig) - int sig; -{ - signal (SIGSEGV, SIG_DFL); -#ifdef SIGIOT - signal (SIGIOT, SIG_DFL); -#endif -#ifdef SIGILL - signal (SIGILL, SIG_DFL); -#endif -#ifdef SIGABRT - signal (SIGABRT, SIG_DFL); -#endif -#ifdef SIGBUS - signal (SIGBUS, SIG_DFL); -#endif - - fatal ("Internal error: %s\n\ -Please submit a full bug report.\n\ -See %s for instructions.", strsignal (sig), GCCBUGURL); -} - /* Push the declarations of builtin types into the namespace. RID_INDEX, if < CP_RID_MAX is the index of the builtin type in the array RID_POINTERS. NAME is the name used when looking @@ -6334,28 +6302,6 @@ init_decl_processing () current_binding_level = NULL_BINDING_LEVEL; free_binding_level = NULL_BINDING_LEVEL; - /* Because most segmentation signals can be traced back into user - code, catch them and at least give the user a chance of working - around compiler bugs. */ - signal (SIGSEGV, signal_catch); - - /* We will also catch aborts in the back-end through signal_catch and - give the user a chance to see where the error might be, and to defeat - aborts in the back-end when there have been errors previously in their - code. */ -#ifdef SIGIOT - signal (SIGIOT, signal_catch); -#endif -#ifdef SIGILL - signal (SIGILL, signal_catch); -#endif -#ifdef SIGABRT - signal (SIGABRT, signal_catch); -#endif -#ifdef SIGBUS - signal (SIGBUS, signal_catch); -#endif - build_common_tree_nodes (flag_signed_char); error_mark_list = build_tree_list (error_mark_node, error_mark_node); diff --git a/gcc/toplev.c b/gcc/toplev.c index 098a2ec3991..cb60d518a53 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -160,7 +160,7 @@ static void set_target_switch PARAMS ((const char *)); static const char *decl_name PARAMS ((tree, int)); static void float_signal PARAMS ((int)) ATTRIBUTE_NORETURN; -static void pipe_closed PARAMS ((int)) ATTRIBUTE_NORETURN; +static void crash_signal PARAMS ((int)) ATTRIBUTE_NORETURN; #ifdef ASM_IDENTIFY_LANGUAGE /* This might or might not be used in ASM_IDENTIFY_LANGUAGE. */ static void output_lang_identify PARAMS ((FILE *)) ATTRIBUTE_UNUSED; @@ -1543,7 +1543,7 @@ float_signal (signo) int signo ATTRIBUTE_UNUSED; { if (float_handled == 0) - abort (); + crash_signal (signo); #if defined (USG) || defined (hpux) signal (SIGFPE, float_signal); /* re-enable the signal catcher */ #endif @@ -1629,14 +1629,17 @@ pop_float_handler (handled, handler) bcopy ((char *) handler, (char *) float_handler, sizeof (float_handler)); } -/* Handler for SIGPIPE. */ +/* Handler for fatal signals, such as SIGSEGV. These are transformed + into ICE messages, which is much more user friendly. */ static void -pipe_closed (signo) +crash_signal (signo) /* If this is missing, some compilers complain. */ - int signo ATTRIBUTE_UNUSED; + int signo; { - fatal ("output pipe has been closed"); + fatal ("Internal error: %s.\n\ +Please submit a full bug report.\n\ +See %s for instructions.", strsignal (signo), GCCBUGURL); } /* Strip off a legitimate source ending from the input string NAME of @@ -4431,12 +4434,27 @@ main (argc, argv) (void) bindtextdomain (PACKAGE, localedir); (void) textdomain (PACKAGE); + /* Install handler for SIGFPE, which may be received while we do + compile-time floating point arithmetic. */ signal (SIGFPE, float_signal); -#ifdef SIGPIPE - signal (SIGPIPE, pipe_closed); + /* Trap fatal signals, e.g. SIGSEGV, and convert them to ICE messages. */ +#ifdef SIGSEGV + signal (SIGSEGV, crash_signal); #endif - +#ifdef SIGILL + signal (SIGILL, crash_signal); +#endif +#ifdef SIGBUS + signal (SIGBUS, crash_signal); +#endif +#ifdef SIGABRT + signal (SIGABRT, crash_signal); +#endif +#if defined SIGIOT && (!defined SIGABRT || SIGABRT != SIGIOT) + signal (SIGIOT, crash_signal); +#endif + decl_printable_name = decl_name; lang_expand_expr = (lang_expand_expr_t) do_abort; -- 2.11.4.GIT