This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/57451] Incorrect debug ranges emitted for -freorder-blocks-and-partition -g


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57451

--- Comment #7 from ccoutant at google dot com ---
> Index: final.c
> ===================================================================
> --- final.c (revision 201461)
> +++ final.c (working copy)
> @@ -1560,6 +1560,16 @@ change_scope (rtx orig_insn, tree s1, tree s2)
>    tree ts1 = s1, ts2 = s2;
>    tree s;
>
> +  if (NOTE_P (orig_insn) && NOTE_KIND (orig_insn) ==
> NOTE_INSN_SWITCH_TEXT_SECTIONS)
> +    {
> +      gcc_assert (s1 == s1);

That should be s1 == s2, right?

> +      rtx note = emit_note_before (NOTE_INSN_BLOCK_END, orig_insn);
> +      NOTE_BLOCK (note) = s1;
> +      note = emit_note_before (NOTE_INSN_BLOCK_BEG, next_insn (orig_insn));
> +      NOTE_BLOCK (note) = s1;
> +      return;
> +    }
> +
>    while (ts1 != ts2)
>      {
>        gcc_assert (ts1 && ts2);
> @@ -1604,12 +1614,16 @@ reemit_insn_block_notes (void)
>    rtx insn, note;
>
>    insn = get_insns ();
> -  if (!active_insn_p (insn))
> -    insn = next_active_insn (insn);
> -  for (; insn; insn = next_active_insn (insn))
> +  for (; insn; insn = next_insn (insn))
>      {
>        tree this_block;
>
> +      if (NOTE_P (insn) && NOTE_KIND (insn) == NOTE_INSN_SWITCH_TEXT_SECTIONS)
> +        change_scope (insn, cur_block, cur_block);

It seems to me like you should just emit the three notes directly
here. This is really using change_scope for a new purpose, as you're
not really changing scopes, just putting a break into one.

> +      if (!active_insn_p (insn))
> +        continue;

I'm not clear on why this is needed. Is it because after the
change_scope, insn will now be a NOTE? If that's it, just put the
continue in the previous if clause.

-cary


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]