Message ID | 60f9fd2b-211e-c1d5-e17a-1fab1ee51338@suse.cz |
---|---|
State | Superseded |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4DE853857B98 for <patchwork@sourceware.org>; Fri, 6 Jan 2023 11:34:12 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id E006C3858D28 for <gcc-patches@gcc.gnu.org>; Fri, 6 Jan 2023 11:33:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E006C3858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B10B0250B9; Fri, 6 Jan 2023 11:33:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1673004834; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=X5sZf1Ab2IigYpyrf/3tZmjBCO1i7g1ukxJrrb5LNLg=; b=zExKpaMtkuz4S565ncNJIWw8w8ThAt067t4/P0DinqGHnWme7FywaV4T84TK//johaVZg2 7Aekg4EczoCX/q3sxoBJ9fLUnsVeyGX5M4KfXDtIlsVh8s+kZLtzzbM0CVhQ1L6vYMlQ7E w+bWMDX8P74PqQTk7r6QK5NjKp/sqZ0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1673004834; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=X5sZf1Ab2IigYpyrf/3tZmjBCO1i7g1ukxJrrb5LNLg=; b=F07UyotxywjnqKZmqRVjwi5JReHyjq4uB6msZXoDfq3OZjvLvMtB7i6cXiGp2r2HivonLF aOPfGqKD8bH0h7Cw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8E71B13596; Fri, 6 Jan 2023 11:33:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EW28ICIHuGPqJQAAMHmgww (envelope-from <mliska@suse.cz>); Fri, 06 Jan 2023 11:33:54 +0000 Message-ID: <60f9fd2b-211e-c1d5-e17a-1fab1ee51338@suse.cz> Date: Fri, 6 Jan 2023 12:33:54 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 From: =?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz> Subject: [PATCH] diagnostics: fix crash with -fdiagnostics-format=json-file To: gcc-patches@gcc.gnu.org Content-Language: en-US Cc: David Malcolm <dmalcolm@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
diagnostics: fix crash with -fdiagnostics-format=json-file
|
|
Commit Message
Martin Liška
Jan. 6, 2023, 11:33 a.m. UTC
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(+)
Comments
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:
On 1/6/23 14:21, David Malcolm wrote: > 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? Hey. I've done a new version of the patch where I utilize x_main_input_basename. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin
PING^1 On 1/10/23 16:10, Martin Liška wrote: > On 1/6/23 14:21, David Malcolm wrote: >> 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? > > Hey. > > I've done a new version of the patch where I utilize x_main_input_basename. > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > Ready to be installed? > Thanks, > Martin
PING^2 On 1/24/23 14:34, Martin Liška wrote: > PING^1 > > On 1/10/23 16:10, Martin Liška wrote: >> On 1/6/23 14:21, David Malcolm wrote: >>> 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? >> >> Hey. >> >> I've done a new version of the patch where I utilize x_main_input_basename. >> >> Patch can bootstrap on x86_64-linux-gnu and survives regression tests. >> >> Ready to be installed? >> Thanks, >> Martin >
PING^3 On 2/1/23 14:13, Martin Liška wrote: > PING^2 > > On 1/24/23 14:34, Martin Liška wrote: >> PING^1 >> >> On 1/10/23 16:10, Martin Liška wrote: >>> On 1/6/23 14:21, David Malcolm wrote: >>>> 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? >>> >>> Hey. >>> >>> I've done a new version of the patch where I utilize x_main_input_basename. >>> >>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests. >>> >>> Ready to be installed? >>> Thanks, >>> Martin >> >
PING^4 On 2/17/23 15:52, Martin Liška wrote: > PING^3 > > On 2/1/23 14:13, Martin Liška wrote: >> PING^2 >> >> On 1/24/23 14:34, Martin Liška wrote: >>> PING^1 >>> >>> On 1/10/23 16:10, Martin Liška wrote: >>>> On 1/6/23 14:21, David Malcolm wrote: >>>>> 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? >>>> >>>> Hey. >>>> >>>> I've done a new version of the patch where I utilize x_main_input_basename. >>>> >>>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests. >>>> >>>> Ready to be installed? >>>> Thanks, >>>> Martin >>> >> >
PING^5 On 2/27/23 10:49, Martin Liška wrote: > PING^4 > > On 2/17/23 15:52, Martin Liška wrote: >> PING^3 >> >> On 2/1/23 14:13, Martin Liška wrote: >>> PING^2 >>> >>> On 1/24/23 14:34, Martin Liška wrote: >>>> PING^1 >>>> >>>> On 1/10/23 16:10, Martin Liška wrote: >>>>> On 1/6/23 14:21, David Malcolm wrote: >>>>>> 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? >>>>> >>>>> Hey. >>>>> >>>>> I've done a new version of the patch where I utilize x_main_input_basename. >>>>> >>>>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests. >>>>> >>>>> Ready to be installed? >>>>> Thanks, >>>>> Martin >>>> >>> >> >
On Tue, 2023-01-10 at 16:10 +0100, Martin Liška wrote: > On 1/6/23 14:21, David Malcolm wrote: > > 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? > > Hey. > > I've done a new version of the patch where I utilize > x_main_input_basename. > > Patch can bootstrap on x86_64-linux-gnu and survives regression > tests. > > Ready to be installed? Sorry about the long delay; the updated patch is good for trunk. Thanks Dave
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: