[gcc r16-6932] diagnostics: Print invocation on ICE
Nathan Sidwell
nathan@gcc.gnu.org
Tue Jan 20 17:31:49 GMT 2026
https://gcc.gnu.org/g:358ab6c5ab4d70967ba83a8b5fc426c34d628316
commit r16-6932-g358ab6c5ab4d70967ba83a8b5fc426c34d628316
Author: Nathan Sidwell <nathan@acm.org>
Date: Sat Nov 1 20:02:47 2025 -0400
diagnostics: Print invocation on ICE
Print the compiler's invocation upon ICE. Particularly useful on LTO
crashes.
gcc/
* diagnostics/context.cc (context::action_after_output): Print
invocation on ICE.
Diff:
---
gcc/diagnostics/context.cc | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/gcc/diagnostics/context.cc b/gcc/diagnostics/context.cc
index 9cb13acc5203..03d570665843 100644
--- a/gcc/diagnostics/context.cc
+++ b/gcc/diagnostics/context.cc
@@ -1003,10 +1003,11 @@ context::action_after_output (enum kind diag_kind)
/* Attempt to ensure that any outputs are flushed e.g. that .sarif
files are written out.
Only do it once. */
- static bool finishing_due_to_ice = false;
- if (!finishing_due_to_ice)
+ static char **saved_argv = nullptr;
+ if (!saved_argv)
{
- finishing_due_to_ice = true;
+ saved_argv = m_original_argv;
+ m_original_argv = nullptr;
finish ();
}
@@ -1021,6 +1022,12 @@ context::action_after_output (enum kind diag_kind)
if (m_abort_on_error)
real_abort ();
+ bool space = false;
+ for (auto *argv = saved_argv; *argv; space = true)
+ fnotice (stderr, &" %s"[1 - space], *argv++);
+ fnotice (stderr, "\n");
+ freeargv (saved_argv);
+
if (m_report_bug)
fnotice (stderr, "Please submit a full bug report, "
"with preprocessed source.\n");
More information about the Gcc-cvs
mailing list