Hi! IMNSHO we want .cfi_restore rbp on leave insn even when that insn isn't setting cfa (on the shrink-wrapped testcase below already the previous load of %r10 sets cfa, but there is no .cfi_restore rbp and we ICE when processing the merge label to which pre-prologue bb jumps (which obviously doesn't have %rbp saved or restored). When not emitting leave, but instead doing ix86_emit_restore_reg_using_pop, we emit the restore note too.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2011-12-06 Jakub Jelinek <ja...@redhat.com> PR target/51354 * config/i386/i386.c (ix86_emit_leave): Call ix86_add_cfa_restore_note unconditionally. * gcc.c-torture/compile/pr51354.c: New test. --- gcc/config/i386/i386.c.jj 2011-12-02 01:52:26.000000000 +0100 +++ gcc/config/i386/i386.c 2011-12-06 10:38:40.370565431 +0100 @@ -10545,9 +10545,9 @@ ix86_emit_leave (void) add_reg_note (insn, REG_CFA_DEF_CFA, plus_constant (stack_pointer_rtx, m->fs.sp_offset)); RTX_FRAME_RELATED_P (insn) = 1; - ix86_add_cfa_restore_note (insn, hard_frame_pointer_rtx, - m->fs.fp_offset); } + ix86_add_cfa_restore_note (insn, hard_frame_pointer_rtx, + m->fs.fp_offset); } /* Emit code to restore saved registers using MOV insns. --- gcc/testsuite/gcc.c-torture/compile/pr51354.c.jj 2011-12-06 10:41:52.069421458 +0100 +++ gcc/testsuite/gcc.c-torture/compile/pr51354.c 2011-12-06 10:41:01.000000000 +0100 @@ -0,0 +1,17 @@ +/* PR target/51354 */ + +extern void abort (void); + +typedef int __attribute__ ((aligned (32))) ai; + +void foo (int *x, ai * y); + +int +bar (int x) +{ + if (x == 12346) + return 24; + ai i; + foo (__builtin_alloca (x), &i); + return 128; +} Jakub