https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103465

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |marxin at gcc dot 
gnu.org
   Target Milestone|---                         |12.0

--- Comment #15 from Martin Liška <marxin at gcc dot gnu.org> ---
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 == UI_SJLJ || ui_except >= 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 = 0;
      opts->x_flag_reorder_blocks = 1;
    }

It's not triggered because of opts->x_flag_unwind_tables is false by default,
but
the option is overwritten in target:

#0  ix86_recompute_optlev_based_flags (opts=0x3c6b1c0 <global_options>,
opts_set=0x3c6c8a0 <global_options_set>) at
/home/marxin/Programming/gcc/gcc/config/i386/i386-options.c:1787
#1  0x0000000001b1c126 in ix86_option_override_internal (main_args_p=true,
opts=0x3c6b1c0 <global_options>, opts_set=0x3c6c8a0 <global_options_set>) 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=false) at
/home/marxin/Programming/gcc/gcc/toplev.c:1238
#4  0x00000000014e6925 in toplev::main (this=0x7fffffffdb7a, argc=21,
argv=0x7fffffffdcc8) at /home/marxin/Programming/gcc/gcc/toplev.c:2320
#5  0x0000000002d423c8 in main (argc=21, argv=0x7fffffffdcc8) at
/home/marxin/Programming/gcc/gcc/main.c:39

...
  if (TARGET_64BIT_P (opts->x_ix86_isa_flags))
    {
      if (opts->x_optimize >= 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 hand,
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.

Reply via email to