From 2d0df1f9a8051d2a89f50e75b9555db06a9fdad8 Mon Sep 17 00:00:00 2001 From: Roger Sayle Date: Fri, 16 Jun 2006 13:21:45 +0000 Subject: re PR middle-end/27802 (ICE with longjmp) PR middle-end/27802 * reg-stack.c (subst_stack_regs): Handle noreturn function calls that (would) return their results in stack registers. * gcc.dg/pr27802-1.c: New test case. From-SVN: r114721 --- gcc/reg-stack.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gcc/reg-stack.c') diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c index 83f4ebb..fc742bd 100644 --- a/gcc/reg-stack.c +++ b/gcc/reg-stack.c @@ -2282,6 +2282,16 @@ subst_stack_regs (rtx insn, stack regstack) if (NOTE_P (insn) || INSN_DELETED_P (insn)) return control_flow_insn_deleted; + /* If this a noreturn call, we can't insert pop insns after it. + Instead, reset the stack state to empty. */ + if (CALL_P (insn) + && find_reg_note (insn, REG_NORETURN, NULL)) + { + regstack->top = -1; + CLEAR_HARD_REG_SET (regstack->reg_set); + return control_flow_insn_deleted; + } + /* If there is a REG_UNUSED note on a stack register on this insn, the indicated reg must be popped. The REG_UNUSED note is removed, since the form of the newly emitted pop insn references the reg, -- cgit v1.1