Problems with inline assembler in gcc-3.2
Jaimon Jose
jjaimon@yahoo.com
Fri Oct 25 02:56:00 GMT 2002
I had been having a set of inline assembly code in my program which was
working fine upto gcc-3.0. I get a compiler error while trying to
compile this program with gcc-3.2. I see that the generated code is
also different with gcc-3.2. This code is not inlined with gcc-3.2.
#include <stdio.h>
static inline int atomic_inc(volatile int *p)
{
__asm__ __volatile__(
"lock; incl %0"
:"=m" (*p)
:"0" (*p));
return (*p);
}
int main(void)
{
int num = 0;
printf("Number after: %d, before: %d\n", atomic_inc(&num), num);
return 0;
}
New documentation doesn't say anything about change of syntaxes in
constraints. So, I want to make sure this is correct before I file a
bug against gcc.
Thanks,
--jaimon
More information about the Gcc-bugs
mailing list