public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: "Martin Liška" <mliska@suse.cz>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] diagnostics: fix crash with -fdiagnostics-format=json-file
Date: Fri, 06 Jan 2023 08:21:31 -0500	[thread overview]
Message-ID: <d8949e7d59ffdac81a0d3bf38fdce379486579cb.camel@redhat.com> (raw)
In-Reply-To: <60f9fd2b-211e-c1d5-e17a-1fab1ee51338@suse.cz>

On Fri, 2023-01-06 at 12:33 +0100, Martin Liška wrote:
> Patch can bootstrap on x86_64-linux-gnu and survives regression
> tests.

Thanks for the patch.

I noticed that you marked PR 108307 as a dup of this, which covers
-fdiagnostics-format=sarif-file (and a .S file as input).

The patch doesn't add any test coverage (for either of the diagnostic
formats).

If we try to emit a diagnostic and base_file_name is NULL, and the user
requested one of -fdiagnostics-format={json,sarif}-file, where do the
diagnostics go?  Where should they go?


Dave



> 
> 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:


  reply	other threads:[~2023-01-06 13:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-06 11:33 Martin Liška
2023-01-06 13:21 ` David Malcolm [this message]
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=d8949e7d59ffdac81a0d3bf38fdce379486579cb.camel@redhat.com \
    --to=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mliska@suse.cz \
    /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).