"spark.z" <spark.yj.zhao@xxxxxxxxx> writes: > void pincrement(int* target) > { > __asm__ __volatile__ ("pushl %eax"); > __asm__ __volatile__ ("lock ; incl (%%eax)" ::"a"(target)); > __asm__ __volatile__ ("popl %eax"); > } Besides all the other answers, don't write your asm code like this. Put all the assembler code in a single asm statement rather than using separate asm statements. In any case the pushl and popl appear to be unnecessary here. Also you should look into the __sync_fetch_and_add and __sync_add_and_fetch builtin functions. Ian