http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55131



Andrew Pinski <pinskia at gcc dot gnu.org> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

             Status|UNCONFIRMED                 |RESOLVED

          Component|c++                         |inline-asm

            Version|unknown                     |4.7.0

         Resolution|                            |INVALID



--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-10-30 
02:28:31 UTC ---

This is not a bug.

The produced assembly looks like:

       movl        8(%ebp), %edi # %1

       movl        12(%ebp), %esi# %2

       movl        0(%esi), %eax

       movl        4(%esi), %edx

       movl        (%ecx), %ebx# %3

       movl        (%eax), %ecx# %4



By the time the last statement happens, eax has already been clobbered.  You

never said you are clobber eax in the inline-asm so it chose the 4th operand as

being eax.  You were getting lucky in 3.4.6 with the inline-asm really,





I don't see why you don't use the __sync_* (or even better the __atomic_*)

builtins for doing the compare and swap?

Reply via email to