Since %ecx can't be used for both DRAP register and __builtin_eh_return, we need to check if crtl->drap_reg uses %ecx before using %ecx for __builtin_eh_return.
Testing on x86-64. OK for trunk if there are no regressions? H.J. --- PR target/70439 * config/i386/i386.c (ix86_expand_epilogue): Properly check conflict between DRAP register and __builtin_eh_return. --- gcc/config/i386/i386.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 1639704..aafe171 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -13463,8 +13463,9 @@ ix86_expand_epilogue (int style) rtx sa = EH_RETURN_STACKADJ_RTX; rtx_insn *insn; - /* Stack align doesn't work with eh_return. */ - gcc_assert (!stack_realign_drap); + /* %ecx can't be used for both DRAP register and eh_return. */ + gcc_assert (!crtl->drap_reg + || REGNO (crtl->drap_reg) != CX_REG); /* Neither does regparm nested functions. */ gcc_assert (!ix86_static_chain_on_stack); -- 2.5.5