GCC inline assembler failure

Florin Ghido ghido@ghidopc.p16.pub.ro
Fri Apr 6 06:18:00 GMT 2001


  Hi,
  I am Florin Ghido, a C/C++ developer using gcc(2.95.2) under Linux/Intel x86.
  I have a problem with gcc inline assembly, and I want to ask if it is a bug
  or it comes from design...

The source code looks like this:
test.cc
-----------
inline void dummy()
{
  __asm__ __volatile__("
  push %eax
  jmp et
  et:
  pop %eax"
  );
}

int main()
{
  dummy();
  dummy();
}
------------
When I compile without optimisations, this complies corectly.
When I compile with -O2 (enabling inline) I get the following error:

/tmp/ccwwJuVh.s:23: Fatal error: Symbol et already defined.

Compiling with -S shows the fact that gcc just copies the asm block twice
in the main and so, the "et" label is defined twice.


Is there a method for gcc to automatically generate label names in inline 
assembly that do not conflict ?
I would appreciate your reponse at ghido@ss.pub.ro

Thanks in advance for your time,

With respect, Florin.





More information about the Gcc mailing list