https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109407
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The inline-asm is incorrect as the EAX/RAX register gets clobbered by cmpxchgl
So you need something like (which works now):
int tmp;
__asm__ __volatile__(
"lock;"
"cmpxchgl %[NEW_VALUE], %[DST];"
"sete %[RET];"
: [RET] "=q"(dwRtnV),[DST] "+m"(dwOriV)
, "=a"(tmp) // newly added
:[NEW_VALUE] "r"(dwDstV), "a"(dwExpV)
: "memory", "cc"
);