This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Problems with inline assembler in gcc-3.2


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





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]