------- Comment #3 from hjl dot tools at gmail dot com 2008-08-03 18:40 ------- 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; } -- hjl dot tools at gmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at ucw dot cz http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37010