[Bug middle-end/106133] ICE: SIGSEGV in diagnostic_output_format_init_json_file() with -fdiagnostics-format=json-file -E

marxin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jun 30 14:25:28 GMT 2022


Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
     Ever confirmed|0                           |1
                 CC|                            |dmalcolm at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-06-30

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
With -E the base_file_name == NULL. What about the following patch:

diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc
index 22f7b0b6d6e..5d0137fd974 100644
--- a/gcc/diagnostic.cc
+++ b/gcc/diagnostic.cc
@@ -2246,6 +2246,9 @@ diagnostic_output_format_init (diagnostic_context
                               const char *base_file_name,
                               enum diagnostics_output_format format)
+  if (base_file_name == NULL)
+    return;
   switch (format)

David, what do you think?

More information about the Gcc-bugs mailing list