[Bug inline-asm/52813] %rsp in clobber list is silently ignored

ubizjak at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Apr 1 18:58:00 GMT 2012


--- Comment #3 from Uros Bizjak <ubizjak at gmail dot com> 2012-04-01 18:58:27 UTC ---
(In reply to comment #2)
> I don't expect the compiler to analyze the asm string.  I expect the compiler
> to respect my clobber list.
> I told GCC that I would clobber %rsp.  Any other register that I put in the
> clobber list causes GCC to save that register to the stack or to another
> register before the asm and restore it from the stack/register after the asm. 
> For example:

%rsp is considered a "fixed" register, used for fixed purposes all throughout
the compiled code and are therefore not available for general allocation.

So, save %rsp at the beginning of your asm code and restore it at the end.

More information about the Gcc-bugs mailing list