From: Nathan Sidwell Date: Sun, 2 Nov 2025 00:02:47 +0000 (-0400) Subject: diagnostics: Print invocation on ICE X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=358ab6c5ab4d70967ba83a8b5fc426c34d628316;p=thirdparty%2Fgcc.git 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 --git a/gcc/diagnostics/context.cc b/gcc/diagnostics/context.cc index 9cb13acc520..03d57066584 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");