------- Comment #6 from Joey dot ye at intel dot com 2008-08-04 08:28 ------- (In reply to comment #3) > Joey, when we compute frame layout, we don't count the duplicated > return address pushed onto stack when DRAP is used. Also when we > push return address, shouldn't we use -UNITS_PER_WORD, instead of > -(STACK_BOUNDARY / BITS_PER_UNIT))? On MacOS, STACK_BOUNDARY is > 128 on ia32. Does this patch make sense? > --- ./i386.c.drap 2008-08-03 09:50:05.000000000 -0700 > +++ ./i386.c 2008-08-03 11:36:40.000000000 -0700 > @@ -7291,6 +7291,10 @@ ix86_compute_frame_layout (struct ix86_f > if (stack_realign_fp) > offset = (offset + stack_alignment_needed -1) & -stack_alignment_needed; > + /* Duplicated return address when DRAP is used. */ > + if (crtl->drap_reg && crtl->stack_realign_needed) > + offset += UNITS_PER_WORD; > + > /* Register save area */ > offset += frame->nregs * UNITS_PER_WORD; > @@ -7692,8 +7696,7 @@ ix86_expand_prologue (void) > expand_builtin_return_addr etc. */ > x = crtl->drap_reg; > x = gen_frame_mem (Pmode, > - plus_constant (x, > - -(STACK_BOUNDARY / BITS_PER_UNIT))); > + plus_constant (x, -UNITS_PER_WORD)); > insn = emit_insn (gen_push (x)); > RTX_FRAME_RELATED_P (insn) = 1; > } I suspect this patch is incorrect. /* Skip return address and saved base pointer. */ offset = frame_pointer_needed ? UNITS_PER_WORD * 2 : UNITS_PER_WORD; already count the duplicated address in. I'm analyzing what makes this case fail.
-- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37010