public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/46682] New: __sync_bool_compare_and_swap generates wrong code
@ 2010-11-27  7:01 us15 at os dot inf.tu-dresden.de
  2010-11-27 17:52 ` [Bug target/46682] " jakub at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: us15 at os dot inf.tu-dresden.de @ 2010-11-27  7:01 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: __sync_bool_compare_and_swap generates wrong code
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: us15@os.inf.tu-dresden.de


Created attachment 22544
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22544
Testcase

Compile testcase with:

gcc-4.5.1  -MP -MMD -pipe -m32 -Os -march=i686 -mpreferred-stack-boundary=2
-mregparm=3 -fdata-sections -ffunction-sections -fomit-frame-pointer
-freg-struct-return -freorder-blocks -funit-at-a-time -fno-exceptions -fno-rtti
-fno-stack-protector -fvisibility-inlines-hidden -Wall -Wextra
-Waggregate-return -Wcast-align -Wcast-qual -Wconversion
-Wdisabled-optimization -Wformat=2 -Wmissing-format-attribute
-Wmissing-noreturn -Wpacked -Wpointer-arith -Wredundant-decls -Wshadow
-Wwrite-strings -Wabi -Wctor-dtor-privacy -Wno-non-virtual-dtor
-Wold-style-cast -Woverloaded-virtual -Wsign-promo -Wframe-larger-than=64
-Wlogical-op -Wstrict-null-sentinel -Wstrict-overflow=5 -Wvolatile-register-var
-c testcase.cc -o testcase.o

This results in:

00000000 <Ec::generate_wrong_code()>:
   0:   53                      push   %ebx
   1:   b8 01 00 00 00          mov    $0x1,%eax
   6:   e8 fc ff ff ff          call   7 <Ec::generate_wrong_code()+0x7>
   b:   31 d2                   xor    %edx,%edx
   d:   31 c9                   xor    %ecx,%ecx
   f:   6a 00                   push   $0x0
  11:   6a 00                   push   $0x0
  13:   6a 00                   push   $0x0
  15:   89 c3                   mov    %eax,%ebx
  17:   e8 fc ff ff ff          call   18 <Ec::generate_wrong_code()+0x18>
  1c:   8b 15 00 00 00 00       mov    0x0,%edx
  22:   31 c0                   xor    %eax,%eax
  24:   f0 0f b1 1a             lock cmpxchg %ebx,(%edx)
  28:   83 c4 0c                add    $0xc,%esp
  2b:   74 07                   je     34 <Ec::generate_wrong_code()+0x34>
  2d:   b8 01 00 00 00          mov    $0x1,%eax
  32:   eb 02                   jmp    36 <Ec::generate_wrong_code()+0x36>
  34:   31 c0                   xor    %eax,%eax
  36:   e8 fc ff ff ff          call   37 <Ec::generate_wrong_code()+0x37>

The "add" at offset 28 is messing up the flags for the "je" at offset 2b.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug target/46682] __sync_bool_compare_and_swap generates wrong code
  2010-11-27  7:01 [Bug c++/46682] New: __sync_bool_compare_and_swap generates wrong code us15 at os dot inf.tu-dresden.de
@ 2010-11-27 17:52 ` jakub at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-11-27 17:52 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|                            |DUPLICATE

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-11-27 17:28:19 UTC ---
Fixed for a long time already.

*** This bug has been marked as a duplicate of bug 45292 ***


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-27 17:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-27  7:01 [Bug c++/46682] New: __sync_bool_compare_and_swap generates wrong code us15 at os dot inf.tu-dresden.de
2010-11-27 17:52 ` [Bug target/46682] " jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).