Message ID | aa789d71-fddb-9111-8734-0c3faba529e0@suse.cz |
---|---|
State | New |
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 A5509385741D for <patchwork@sourceware.org>; Mon, 4 Oct 2021 10:31:30 +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 B919E3858409 for <gcc-patches@gcc.gnu.org>; Mon, 4 Oct 2021 10:31:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B919E3858409 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 825D52229F for <gcc-patches@gcc.gnu.org>; Mon, 4 Oct 2021 10:31:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1633343472; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LdG/ftbbh7tPhL8aonJ83NWKWAOo1ioRcn7bhOZqozA=; b=tDfEeUPQW8FbrZCKdXMtls4QhbG5IiVz4622m8KYKq9L0J12/NkCaxOvYF7LpJN2Q4O9A/ VfuMjjZZxp+gt5vY2VyRx1UU+tzOSRJU+UdQhHhoY9BvPBQkywSbgWt1hqKZ6x/aWAmVrM +k5++ERvn+Ute+xF0bFT7LfSbYD/T58= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1633343472; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LdG/ftbbh7tPhL8aonJ83NWKWAOo1ioRcn7bhOZqozA=; b=CUZ6z2pUESXidFgyS6DHG6V3HpxXV3A/M06XRbvCKxCa5YUrJBjv7HbjA16gdmkO5onsk5 JjxN/4ApryYSiuCA== 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 64454139C1 for <gcc-patches@gcc.gnu.org>; Mon, 4 Oct 2021 10:31:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 82pjF/DXWmEiYAAAMHmgww (envelope-from <mliska@suse.cz>) for <gcc-patches@gcc.gnu.org>; Mon, 04 Oct 2021 10:31:12 +0000 Message-ID: <aa789d71-fddb-9111-8734-0c3faba529e0@suse.cz> Date: Mon, 4 Oct 2021 12:31:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.1 From: =?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz> Subject: [PATCH] debug: Handle x_flag_var_tracking_* in finish_options [PR102585] To: gcc-patches@gcc.gnu.org Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.3 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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 |
debug: Handle x_flag_var_tracking_* in finish_options [PR102585]
|
|
Commit Message
Martin Liška
Oct. 4, 2021, 10:31 a.m. UTC
Hello. The patch sets -1 for x_flag_var_tracking and x_flag_var_tracking_assignments similarly to toplev.c. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin PR debug/102585 gcc/ChangeLog: * opts.c (finish_options): Similarly to toplev.c (process_options), set value -1. gcc/testsuite/ChangeLog: * gcc.dg/pr102585.c: New test. --- gcc/opts.c | 3 +++ gcc/testsuite/gcc.dg/pr102585.c | 6 ++++++ 2 files changed, 9 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr102585.c
Comments
On Mon, Oct 4, 2021 at 12:31 PM Martin Liška <mliska@suse.cz> wrote: > > Hello. > > The patch sets -1 for x_flag_var_tracking and x_flag_var_tracking_assignments similarly > to toplev.c. > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > Ready to be installed? > Thanks, > Martin > > PR debug/102585 > > gcc/ChangeLog: > > * opts.c (finish_options): Similarly to toplev.c > (process_options), set value -1. > > gcc/testsuite/ChangeLog: > > * gcc.dg/pr102585.c: New test. > --- > gcc/opts.c | 3 +++ > gcc/testsuite/gcc.dg/pr102585.c | 6 ++++++ > 2 files changed, 9 insertions(+) > create mode 100644 gcc/testsuite/gcc.dg/pr102585.c > > diff --git a/gcc/opts.c b/gcc/opts.c > index 6503980cd33..f2f058b3ece 100644 > --- a/gcc/opts.c > +++ b/gcc/opts.c > @@ -1343,6 +1343,9 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set, > opts->x_flag_complex_method = 1; > else if (opts_set->x_flag_cx_fortran_rules) > opts->x_flag_complex_method = opts->x_flag_default_complex_method; > + > + if (opts->x_flag_var_tracking_assignments && !opts->x_flag_var_tracking) > + opts->x_flag_var_tracking = opts->x_flag_var_tracking_assignments = -1; I can see how this affects later tests in process_options like if (flag_var_tracking_uninit == AUTODETECT_VALUE) flag_var_tracking_uninit = flag_var_tracking; would now become -1 instead of zero? So iff then probably this whole block would need to move but the option handling code is a sophisticated mess between FE, target and middle-end ... diff --git a/gcc/toplev.c b/gcc/toplev.c index ec9f998a49b..fec72b1365a 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -2147,8 +2147,6 @@ standard_type_bitsize (int bitsize) static void do_compile () { - process_options (); - /* Don't do any more if an error has already occurred. */ if (!seen_error ()) { @@ -2368,6 +2366,8 @@ toplev::main (int argc, char **argv) /* Exit early if we can (e.g. -help). */ if (!exit_after_options) { + process_options (); + if (m_use_TV_TOTAL) start_timevars (); do_compile (); would at least make the flow a bit more obvious ;) IIRC process_options was/is supposed to be the place to emit diagnostics about options but clearly it's doing even more. I guess outlining the call to lang_hooks.post_options would be another piece to make the flow clearer, likewise setting of optimization_default_node ... Richard. > } > > #define LEFT_COLUMN 27 > diff --git a/gcc/testsuite/gcc.dg/pr102585.c b/gcc/testsuite/gcc.dg/pr102585.c > new file mode 100644 > index 00000000000..efd066b4a4e > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pr102585.c > @@ -0,0 +1,6 @@ > +/* PR debug/102585 */ > +/* { dg-do compile } */ > +/* { dg-options "-fvar-tracking-assignments -fno-var-tracking" } */ > + > +#pragma GCC optimize 0 > +void d_demangle_callback_Og() { int c = 0; } > -- > 2.33.0 >
On Mon, Oct 04, 2021 at 01:41:36PM +0200, Richard Biener via Gcc-patches wrote: > > The patch sets -1 for x_flag_var_tracking and x_flag_var_tracking_assignments similarly > > to toplev.c. > > > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Shouldn't all those flag_* == AUTODETECT_VALUE be converted to !global_options_set.x_flag_* or at least !global_options_set.x_flag_* && flag_* == AUTODETECT_VALUE ? Jakub
On 10/4/21 13:45, Jakub Jelinek wrote: > On Mon, Oct 04, 2021 at 01:41:36PM +0200, Richard Biener via Gcc-patches wrote: >>> The patch sets -1 for x_flag_var_tracking and x_flag_var_tracking_assignments similarly >>> to toplev.c. >>> >>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > Shouldn't all those flag_* == AUTODETECT_VALUE be converted to > !global_options_set.x_flag_* or at least > !global_options_set.x_flag_* && flag_* == AUTODETECT_VALUE ? Reading the code one more time, yes, I think so. It's pretty ugly code right now, let me investigate what can we do with that.. Martin
diff --git a/gcc/opts.c b/gcc/opts.c index 6503980cd33..f2f058b3ece 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -1343,6 +1343,9 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set, opts->x_flag_complex_method = 1; else if (opts_set->x_flag_cx_fortran_rules) opts->x_flag_complex_method = opts->x_flag_default_complex_method; + + if (opts->x_flag_var_tracking_assignments && !opts->x_flag_var_tracking) + opts->x_flag_var_tracking = opts->x_flag_var_tracking_assignments = -1; } #define LEFT_COLUMN 27 diff --git a/gcc/testsuite/gcc.dg/pr102585.c b/gcc/testsuite/gcc.dg/pr102585.c new file mode 100644 index 00000000000..efd066b4a4e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr102585.c @@ -0,0 +1,6 @@ +/* PR debug/102585 */ +/* { dg-do compile } */ +/* { dg-options "-fvar-tracking-assignments -fno-var-tracking" } */ + +#pragma GCC optimize 0 +void d_demangle_callback_Og() { int c = 0; }