[Bug inline-asm/39078] Registers in on clober list are cloberred when compiled with optimization (x86_64) ?
valery_reznic at yahoo dot com
gcc-bugzilla@gcc.gnu.org
Mon Feb 9 16:08:00 GMT 2009
------- Comment #5 from valery_reznic at yahoo dot com 2009-02-09 16:07 -------
(In reply to comment #3)
> > > r11 is saved by the caller so this is the generated code is valid.
> > > Since nothing else uses r11 in the inline-asm, the code is correct.
> > The problem is not that r11 not saved at stack, but that saved on the stack
> > value of r15 ALWAYS will be overwritten - by the 'call my_syscall' instruction
> > and saved on the stack values of rbx, r12, r13 and r14 MAY BE overritten if
> > my_syscall function wrote something to the stack
>
> These values have been saved into red-zone area. Since gcc does not know that
> you have a call in the asm it thinks that func_1 is a leaf function where
> redzone area can be used for temporary storage.
>
> You can use -mno-red-zone to disable red-zone, but in reality, you should not
> call other functions from inside asm.
>
Aha, no I realized why compiler is right. Still if it will mentioned in the
gcc's docs about inline assembler it will be nice.
Any why you say I shouldn't call other function from inside asm ?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39078
More information about the Gcc-bugs
mailing list