public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] diagnostics: fix crash with -fdiagnostics-format=json-file
@ 2023-01-06 11:33 Martin Liška
  2023-01-06 13:21 ` David Malcolm
  0 siblings, 1 reply; 9+ messages in thread
From: Martin Liška @ 2023-01-06 11:33 UTC (permalink / raw)
  To: gcc-patches; +Cc: David Malcolm

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-03-16 14:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-06 11:33 [PATCH] diagnostics: fix crash with -fdiagnostics-format=json-file Martin Liška
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

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).