From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 258DC3858C3A; Thu, 9 Dec 2021 19:29:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 258DC3858C3A From: "marxin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/103465] Invalid note with -fno-reorder-blocks-and-partition Date: Thu, 09 Dec 2021 19:29:31 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 11.2.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: marxin at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: marxin at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status assigned_to target_milestone Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Dec 2021 19:29:31 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103465 Martin Li=C5=A1ka changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |ASSIGNED Assignee|unassigned at gcc dot gnu.org |marxin at gcc dot g= nu.org Target Milestone|--- |12.0 --- Comment #15 from Martin Li=C5=A1ka --- All right, got it even with the cross compiler. So what happens with the test-case without the optimize attribute: - options are parsed and finish_options is called: if (opts->x_flag_unwind_tables && !targetm_common.unwind_tables_default && opts->x_flag_reorder_blocks_and_partition && (ui_except =3D=3D UI_SJLJ || ui_except >=3D UI_TARGET)) { if (opts_set->x_flag_reorder_blocks_and_partition) inform (loc, "%<-freorder-blocks-and-partition%> does not support " "unwind info on this architecture"); opts->x_flag_reorder_blocks_and_partition =3D 0; opts->x_flag_reorder_blocks =3D 1; } It's not triggered because of opts->x_flag_unwind_tables is false by defaul= t, but the option is overwritten in target: #0 ix86_recompute_optlev_based_flags (opts=3D0x3c6b1c0 , opts_set=3D0x3c6c8a0 ) at /home/marxin/Programming/gcc/gcc/config/i386/i386-options.c:1787 #1 0x0000000001b1c126 in ix86_option_override_internal (main_args_p=3Dtrue, opts=3D0x3c6b1c0 , opts_set=3D0x3c6c8a0 ) at /home/marxin/Programming/gcc/gcc/config/i386/i386-options.c:2332 #2 0x0000000001b1de5f in ix86_option_override () at /home/marxin/Programming/gcc/gcc/config/i386/i386-options.c:2961 #3 0x00000000014e44be in process_options (no_backend=3Dfalse) at /home/marxin/Programming/gcc/gcc/toplev.c:1238 #4 0x00000000014e6925 in toplev::main (this=3D0x7fffffffdb7a, argc=3D21, argv=3D0x7fffffffdcc8) at /home/marxin/Programming/gcc/gcc/toplev.c:2320 #5 0x0000000002d423c8 in main (argc=3D21, argv=3D0x7fffffffdcc8) at /home/marxin/Programming/gcc/gcc/main.c:39 ... if (TARGET_64BIT_P (opts->x_ix86_isa_flags)) { if (opts->x_optimize >=3D 1) SET_OPTION_IF_UNSET (opts, opts_set, flag_omit_frame_pointer, !USE_IX86_FRAME_POINTER); if (opts->x_flag_asynchronous_unwind_tables && TARGET_64BIT_MS_ABI) SET_OPTION_IF_UNSET (opts, opts_set, flag_unwind_tables, 1); ... and so x_flag_reorder_blocks_and_partition is not dropped. On the other han= d, when optimize attribute is used, then finish_options is called for it and we see the note and the flagged dropped. So the checking code should be called both from process_options and finish_options. Option handling is a can of worms. Lemme test a patch tomorrow.=