https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109407

--- Comment #2 from johgjc <johgjc at yeah dot net> ---
thank you very much.


At 2023-04-04 23:55:25, "pinskia at gcc dot gnu.org" <gcc-bugzi...@gcc.gnu.org>
wrote:
>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"
>);
>
>-- 
>You are receiving this mail because:
>You reported the bug.

Reply via email to