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]

[Bug inline-asm/55131] Segmentation fault happened in resulting code (inline-asm) after upgraded g++ from 3.4.6 to 4.7.0


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?


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