public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/PR106133-json-diagnostics-fix)] diagnostics: fix crash with -fdiagnostics-format=json-file
@ 2023-01-06 10:21 Martin Liska
0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2023-01-06 10:21 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:e31e295120925353e7ad56c8bf47fd0564d4f745
commit e31e295120925353e7ad56c8bf47fd0564d4f745
Author: Martin Liska <mliska@suse.cz>
Date: Fri Jan 6 11:19:52 2023 +0100
diagnostics: fix crash with -fdiagnostics-format=json-file
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.
Diff:
---
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:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-01-06 10:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-06 10:21 [gcc(refs/users/marxin/heads/PR106133-json-diagnostics-fix)] diagnostics: fix crash with -fdiagnostics-format=json-file Martin Liska
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).