When a subprocess (say, lto1) gets killed by SIGKILL on Linux with
LANG=en_..., the message GCC prints is "Killed signal terminated program
lto1".
This message is a little bit unclear - the "Killed" is certainly not
something that gramatically fits there, and the syscall for sending a
signal is called "kill", so the above sounds like an incorrect way of
saying "program lto1 was killed by some signal".
I can't find any decent description of what the correct class of words
strsignal returns, so, lets instead print "PROG terminated by signal
9 (Killed)". This is clearer; it states that signal 9 is at fault and
gives the OS-provided "descriptive string" corresponding to that signal.
Example:
~/gcc/_b_gcc/gcc$ ./xgcc -B. -x c -
xgcc: fatal error: cc1 terminated by signal 9 (Killed)
compilation terminated.
~/gcc/_b_gcc/gcc 1 $
gcc/ChangeLog:
* gcc.cc (execute): Make "signal terminated program" message
clearer.
Suggested-by: Alexander Monakov <[email protected]>
---
> "PROG terminated by" (not "killed", to match the actual change)
> [...]
> Ditto here.
> [...]
> The last argument (commands[i].prog) should not be there (doesn't it trigger
> a warning?)
Yes, I sent the wrong copy. I accidentally left the extra argument in
place, pushed to a cfarm machine, noticed the error, fixed the argument,
but never pulled into the worktree I then sent from.
Here's the patch I actually tested.
> Do we want (%qs) instead of (%s) for signal string so it's formatted
> in quotes?
I'm not sure more delineation is necessary, since it is already
parenthesized.
gcc/gcc.cc | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index b8b0db4ed5e4..ca4e397bb5cb 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -3563,9 +3563,10 @@ execute (void)
thinking there's a compiler bug. Much more likely is
the user or OOM killer nuked it. */
fatal_error (input_location,
- "%s signal terminated program %s",
- strsignal (WTERMSIG (status)),
- commands[i].prog);
+ "%s terminated by signal %d (%s)",
+ commands[i].prog,
+ WTERMSIG (status),
+ strsignal (WTERMSIG (status)));
break;
#ifdef SIGPIPE
--
2.55.0