http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49230
gee <jojelino at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|INVALID | --- Comment #7 from gee <jojelino at gmail dot com> 2011-06-29 19:35:20 UTC --- (In reply to comment #3) > As register ebp is used by gcc as internal frame-register. Even if you are > specifying -fomit-frame-pointer as option, the main function will still have a > frame-pointer setup. Also ebp-register is a callee-saved register, which means > its use as local-register variable is in general nothing wise to do. maybe the following could be counterexample. this code is from gcc 2011110622. ebp may be not internal frame pointer. so in this case setjmp can store invalid ebp. nlg_notify dereferences ebp,causing sigsegv not only it don't use framepointer, but also it doesn't restore framepointer LFE104: .p2align 4,,15 .globl _rb_ensure .def _rb_ensure; .scl 2; .type 32; .endef _rb_ensure: LFB105: .loc 2 727 0 is_stmt 1 .cfi_startproc LVL835: pushl %ebx LCFI228: .cfi_def_cfa_offset 8 .cfi_offset 3, -8 subl $120, %esp LCFI229: .cfi_def_cfa_offset 128 LBB566: .loc 2 731 0 movl _ruby_current_thread, %eax LBE566: .loc 2 729 0 movl $4, 32(%esp) LVL836: LBB567: .loc 2 731 0 movl $0, 100(%esp) movl %eax, %edx movl %eax, 28(%esp) LVL837: movl 152(%eax), %eax movl %eax, 108(%esp) leal 36(%esp), %eax movl %eax, 152(%edx) .loc 2 732 0 movl %eax, (%esp) call __setjmp LVL838: testl %eax, %eax movl %eax, %ebx LVL839: je L733 .loc 2 735 0 movl 108(%esp), %eax LVL840: movl 28(%esp), %edx movl %eax, 152(%edx) LBE567: .loc 2 738 0 movl 140(%esp), %eax movl %eax, (%esp) call *136(%esp) LVL841: .loc 2 740 0 movl _ruby_current_thread, %eax movl %ebx, 4(%esp) movl 152(%eax), %eax movl %eax, (%esp) call _longjmp LVL842: .p2align 4,,10 L733: LBB568: .loc 2 733 0 movl 132(%esp), %eax movl %eax, (%esp) call *128(%esp) LVL843: .loc 2 735 0 movl 28(%esp), %edx .loc 2 733 0 movl %eax, 32(%esp) .loc 2 735 0 movl 108(%esp), %eax movl %eax, 152(%edx) LBE568: .loc 2 738 0 movl 140(%esp), %eax movl %eax, (%esp) call *136(%esp) LVL844: .loc 2 741 0 movl 32(%esp), %eax .loc 2 742 0 addl $120, %esp LCFI230: .cfi_def_cfa_offset 8 popl %ebx LCFI231: .cfi_def_cfa_offset 4 .cfi_restore 3 LVL845: ret .cfi_endproc LFE105: .p2align 4,,15 .globl _rb_frame_this_func .def _rb_frame_this_func; .scl 2; .type 32; .endef _rb_frame_this_func: LFB108: .loc 2 791 0 .cfi_startproc .loc 2 792 0 movl _ruby_current_thread, %eax movl 16(%eax), %eax jmp _frame_func_id LVL846: .cfi_endproc LFE108: