From 34cd1bd74c2afe5a0e14182e7275836d91ed462d Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Fri, 13 Jan 1995 19:37:56 -0500 Subject: [PATCH] (execute): Don't wait for just any N subprocesses... (execute): Don't wait for just any N subprocesses, since we may have started with some subprocesses before we started executing. Wait just for _our_ N subprocesses. From-SVN: r8746 --- gcc/gcc.c | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/gcc/gcc.c b/gcc/gcc.c index 84ae4efa32b..d894e3b6bfb 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -1,5 +1,5 @@ /* Compiler driver program that can handle many languages. - Copyright (C) 1987, 1989, 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright (C) 1987, 89, 92, 93, 94, 1995 Free Software Foundation, Inc. This file is part of GNU CC. @@ -2276,16 +2276,18 @@ execute () /* Wait for all the subprocesses to finish. We don't care what order they finish in; - we know that N_COMMANDS waits will get them all. */ + we know that N_COMMANDS waits will get them all. + Ignore subprocesses that we don't know about, + since they can be spawned by the process that exec'ed us. */ { int ret_code = 0; - for (i = 0; i < n_commands; i++) + for (i = 0; i < n_commands; ) { + int j; int status; int pid; - char *prog = "unknown"; #ifdef __MSDOS__ status = pid = commands[i].pid; @@ -2299,24 +2301,25 @@ execute () if (pid < 0) abort (); - if (status != 0) - { - int j; - for (j = 0; j < n_commands; j++) - if (commands[j].pid == pid) - prog = commands[j].prog; - - if (WIFSIGNALED (status)) - { - fatal ("Internal compiler error: program %s got fatal signal %d", - prog, WTERMSIG (status)); - signal_count++; - ret_code = -1; - } - else if (WIFEXITED (status) - && WEXITSTATUS (status) >= MIN_FATAL_STATUS) - ret_code = -1; - } + for (j = 0; j < n_commands; j++) + if (commands[j].pid == pid) + { + i++; + if (status != 0) + { + if (WIFSIGNALED (status)) + { + fatal ("Internal compiler error: program %s got fatal signal %d", + commands[j].prog, WTERMSIG (status)); + signal_count++; + ret_code = -1; + } + else if (WIFEXITED (status) + && WEXITSTATUS (status) >= MIN_FATAL_STATUS) + ret_code = -1; + } + break; + } } return ret_code; } -- 2.30.2