[Bug debug/60438] [4.9 Regression] dwarf2cfi :2239 still assert,not the same cause as PR 59575

manjian2006 at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Mar 8 06:42:00 GMT 2014


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

--- Comment #14 from linzj <manjian2006 at gmail dot com> ---
Somebody may ask why the modification of cur_cfa->reg will finally trigger
assertion failure.Checkout out notice_args_size in dwarf2cfi.c:
  /* If the CFA is computed off the stack pointer, then we must adjust
     the computation of the CFA as well.  */
  if (cur_cfa->reg == dw_stack_pointer_regnum)
    {
      gcc_assert (!cur_cfa->indirect);

      /* Convert a change in args_size (always a positive in the
     direction of stack growth) to a change in stack pointer.  */
#ifndef STACK_GROWS_DOWNWARD
      delta = -delta;
#endif
      cur_cfa->offset += delta;
    }
See? Only when cur_cfa->reg == dw_stack_pointer_regnum,can we do
cur_cfa->offset += delta.The bug won't be triggered,because all the argument
sizes are ignored.
(The mismatch of the argument sizes causes this bug.)
So before r205498,omitting the frame pointer may result in a wrong dwarf2
output.

(In reply to linzj from comment #13)
> Thank Jakub for the short test case and the revision.
> Before revision 205498,the prologue is:
> (insn/f:TI 77 78 79 2 (parallel [
>             (set (reg/f:SI 7 sp)
>                 (plus:SI (reg/f:SI 7 sp)
>                     (const_int -36 [0xffffffffffffffdc])))
>             (clobber (reg:CC 17 flags))
>             (clobber (mem:BLK (scratch) [0  A8]))
>         ]) 1.cpp:11 798 {pro_epilogue_adjust_stack_si_add}
>      (expr_list:REG_UNUSED (reg:CC 17 flags)
>         (nil)))
> Then r205498:
> (insn/f:TI 75 76 77 2 (parallel [
>             (set (reg/f:SI 7 sp)
>                 (plus:SI (reg/f:SI 7 sp)
>                     (const_int -40 [0xffffffffffffffd8])))
>             (clobber (reg:CC 17 flags))
>             (clobber (mem:BLK (scratch) [0  A8]))
>         ]) 1.cpp:11 798 {pro_epilogue_adjust_stack_si_add}
>      (expr_list:REG_UNUSED (reg:CC 17 flags)
>         (expr_list:REG_CFA_ADJUST_CFA (set (reg/f:SI 7 sp)
>                 (plus:SI (reg/f:SI 7 sp)
>                     (const_int -40 [0xffffffffffffffd8])))
> 
> See the added REG_CFA_ADJUST_CFA?,that make the cur_cfa->reg ==
> dw_stack_pointer_regnum.Before r205498,without this expr,cur_cfa->reg ==
> dw_frame_pointer_regnum.
> 
> And we can see r205498 actually makes the data looks right.Because we have
> omitted the frame pointer, so cur_cfa->reg == dw_frame_pointer_regnum makes
> no sense.So the real problem is still the jump2 pass.It should never cross
> jump between two blocks without the same REG_ARGS_SIZE.



More information about the Gcc-bugs mailing list