Commit c334349b by Zack Weinberg

gcc.c (execute): If a subprocess gets a fatal signal...

	* gcc.c (execute): If a subprocess gets a fatal signal, report
	strsignal() of the signal number, and ask for a bug report.
	Do not do this for SIGPIPE if there's already been an error.

	* tradcpp.c: Don't include signal.h.  Don't catch SIGPIPE.
	Delete pipe_closed.

From-SVN: r35006
parent dcacfa04
...@@ -2653,22 +2653,35 @@ execute () ...@@ -2653,22 +2653,35 @@ execute ()
if (commands[j].pid == pid) if (commands[j].pid == pid)
{ {
i++; i++;
if (status != 0) if (WIFSIGNALED (status))
{ {
if (WIFSIGNALED (status)) #ifdef SIGPIPE
{ /* SIGPIPE is a special case. It happens in -pipe mode
fatal ("Internal compiler error: program %s got fatal signal %d", when the compiler dies before the preprocessor is
commands[j].prog, WTERMSIG (status)); done, or the assembler dies before the compiler is
signal_count++; done. There's generally been an error already, and
ret_code = -1; this is just fallout. So don't generate another error
} unless we would otherwise have succeeded. */
else if (WIFEXITED (status) if (WTERMSIG (status) == SIGPIPE
&& WEXITSTATUS (status) >= MIN_FATAL_STATUS) && (signal_count || greatest_status >= MIN_FATAL_STATUS))
{ ;
if (WEXITSTATUS (status) > greatest_status) else
greatest_status = WEXITSTATUS (status); #endif
ret_code = -1; fatal ("\
} Internal error: %s (program %s)\n\
Please submit a full bug report.\n\
See %s for instructions.",
strsignal (WTERMSIG (status)), commands[j].prog,
GCCBUGURL);
signal_count++;
ret_code = -1;
}
else if (WIFEXITED (status)
&& WEXITSTATUS (status) >= MIN_FATAL_STATUS)
{
if (WEXITSTATUS (status) > greatest_status)
greatest_status = WEXITSTATUS (status);
ret_code = -1;
} }
#ifdef HAVE_GETRUSAGE #ifdef HAVE_GETRUSAGE
if (report_times && ut + st != 0) if (report_times && ut + st != 0)
......
...@@ -28,8 +28,6 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. ...@@ -28,8 +28,6 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#include "version.h" #include "version.h"
#include "cppdefault.h" #include "cppdefault.h"
#include <signal.h>
typedef unsigned char U_CHAR; typedef unsigned char U_CHAR;
/* Name under which this program was invoked. */ /* Name under which this program was invoked. */
...@@ -387,7 +385,6 @@ U_CHAR *skip_to_end_of_comment PARAMS ((FILE_BUF *, int *)); ...@@ -387,7 +385,6 @@ U_CHAR *skip_to_end_of_comment PARAMS ((FILE_BUF *, int *));
U_CHAR *skip_quoted_string PARAMS ((U_CHAR *, U_CHAR *, int, U_CHAR *skip_quoted_string PARAMS ((U_CHAR *, U_CHAR *, int,
int *, int *, int *)); int *, int *, int *));
void pipe_closed PARAMS ((int));
int main PARAMS ((int, char **)); int main PARAMS ((int, char **));
/* Convenience. Write U"string" to get an unsigned string constant. */ /* Convenience. Write U"string" to get an unsigned string constant. */
...@@ -457,15 +454,6 @@ int deps_column; ...@@ -457,15 +454,6 @@ int deps_column;
/* Nonzero means -I- has been seen, /* Nonzero means -I- has been seen,
so don't look for #include "foo" the source-file directory. */ so don't look for #include "foo" the source-file directory. */
int ignore_srcdir; int ignore_srcdir;
/* Handler for SIGPIPE. */
void
pipe_closed (dummy)
int dummy ATTRIBUTE_UNUSED;
{
exit (FATAL_EXIT_CODE);
}
int int
main (argc, argv) main (argc, argv)
...@@ -515,8 +503,6 @@ main (argc, argv) ...@@ -515,8 +503,6 @@ main (argc, argv)
dump_macros = 0; dump_macros = 0;
no_output = 0; no_output = 0;
signal (SIGPIPE, pipe_closed);
max_include_len = cpp_GCC_INCLUDE_DIR_len + 7; /* ??? */ max_include_len = cpp_GCC_INCLUDE_DIR_len + 7; /* ??? */
memset (pend_files, 0, argc * sizeof (char *)); memset (pend_files, 0, argc * sizeof (char *));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment