warning: listing the stack pointer register 'esp' in a clobber list is deprecated

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



After upgrading to 9.1, gcc now warns about clobbering "esp" in an asm
statement.

But consider the following code, where esp is only modified during the
asm template, and restored before returning:

    asm("push es;"
        "mov es, %w0;"
        "call fword ptr %1;"
        "pop es;"
        :: "rm" (seg), "m" (p) : "esp");

Here both operands may resolve to [esp+...], which the push/pop
instructions invalidate. One could work around this by using "r" for the
first operand, but for the call operand, only "m" is valid. It is also
impossible to specify a segment register as clobbered.
I found that specifying "esp" in the clobber list forces the compiler to
save a frame pointer and use ebp-based addressing instead.
I have several instances like this, where I need to save things on the
stack and use "m" operands inbetween. Is there a specific constraint I
can use for this situation? I haven't been able to find it in the
documentation.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux