www.delorie.com/djgpp/bugs/show.cgi   search  
Bug 000220

When Created: 05/11/1998 00:57:39
Against DJGPP version: 2.01
By whom: nate@cartsys.com
Abstract: Pseudo-bug: Inline asm, "g", push/pop, `-fomit-frame-pointer'
This is not really a bug, but I'm entering it here in case anybody
should think it is.

If, in inline asm, you use a local variable as an operand with the "g" 
constraint inside a push/pop pair when compiling with `-fomit-frame-pointer',
you will get bad code generated.  An example of this would be:

void f(unsigned sel) {
asm("pushl %%es;
     movl %0, %%es;
     /* code */
     popl %%es;" : : "g" (selector));
}

This is because GCC generates the addresses for arguments and local
variables relative to %esp when -fomit-frame-pointer. It doesn't know
that you've changed %esp with your `push', so the address comes out wrong
and life is generally unpleasant.

I reported this to the GCC maintainers, and the consensus is that there is
no good way for GCC to avoid this.

Workaround added: 05/11/1998 00:58:37
By whom: nate@cartsys.com
Don't do that. :)

Closed on 04/13/1999 06:00:50: Not a DJGPP bug.
By whom: eliz@is.elta.co.il



  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2010   by DJ Delorie     Updated Jul 2010