From: "Martin Liška" <mliska@suse.cz>
To: gcc-patches@gcc.gnu.org
Cc: David Malcolm <dmalcolm@redhat.com>
Subject: [PATCH] diagnostics: fix crash with -fdiagnostics-format=json-file
Date: Fri, 6 Jan 2023 12:33:54 +0100 [thread overview]
Message-ID: <60f9fd2b-211e-c1d5-e17a-1fab1ee51338@suse.cz> (raw)
Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
Ready to be installed?
Thanks,
Martin
PR middle-end/106133
gcc/ChangeLog:
* diagnostic.cc (diagnostic_output_format_init): If
-fdiagnostics-format=json-file and -E is used, then
base_file_name is null and we should not emit anything.
---
gcc/diagnostic.cc | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc
index c90c14e993e..fe7d121e340 100644
--- a/gcc/diagnostic.cc
+++ b/gcc/diagnostic.cc
@@ -2277,6 +2277,9 @@ diagnostic_output_format_init (diagnostic_context *context,
const char *base_file_name,
enum diagnostics_output_format format)
{
+ if (base_file_name == NULL)
+ return;
+
switch (format)
{
default:
--
2.39.0
next reply other threads:[~2023-01-06 11:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-06 11:33 Martin Liška [this message]
2023-01-06 13:21 ` David Malcolm
2023-01-10 15:10 ` Martin Liška
2023-01-24 13:34 ` Martin Liška
2023-02-01 13:13 ` Martin Liška
2023-02-17 14:52 ` Martin Liška
2023-02-27 9:49 ` Martin Liška
2023-03-16 10:05 ` Martin Liška
2023-03-16 14:45 ` David Malcolm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=60f9fd2b-211e-c1d5-e17a-1fab1ee51338@suse.cz \
--to=mliska@suse.cz \
--cc=dmalcolm@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).