public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/60658] New: std::atomic<T*> is unexpectedly not lock-free
@ 2014-03-25 17:07 ppluzhnikov at google dot com
  2014-03-25 18:45 ` [Bug libstdc++/60658] " redi at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: ppluzhnikov at google dot com @ 2014-03-25 17:07 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60658
           Summary: std::atomic<T*> is unexpectedly not lock-free
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppluzhnikov at google dot com

Using current trunk (r208813):

g++ -std=c++11 atomic.cc -latomic && ./a.out
a.out: atomic.cc:20: int main(): Assertion `b.is_lock_free()' failed.

As far as I can tell, this is happening because

  std::__atomic_base<Bar*>::_M_type_size()

returns sizeof(Bar) instead of returning sizeof(Bar*).


// atomic.cc
#include <atomic>
#include <assert.h>

struct Foo {
  char buf[1];
};

struct Bar {
  char buf[100];
};


int
main ()
{
  std::atomic<Foo*> a;
  assert (a.is_lock_free());

  std::atomic<Bar*> b;
  assert (b.is_lock_free());
}


Google ref: b/13626319


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

* [Bug libstdc++/60658] std::atomic<T*> is unexpectedly not lock-free
  2014-03-25 17:07 [Bug libstdc++/60658] New: std::atomic<T*> is unexpectedly not lock-free ppluzhnikov at google dot com
@ 2014-03-25 18:45 ` redi at gcc dot gnu.org
  2014-03-25 19:17 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-25 18:45 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-03-25
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Oops - I thought we'd fixed all those kind of bugs in the atomic<T*>
specialization


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

* [Bug libstdc++/60658] std::atomic<T*> is unexpectedly not lock-free
  2014-03-25 17:07 [Bug libstdc++/60658] New: std::atomic<T*> is unexpectedly not lock-free ppluzhnikov at google dot com
  2014-03-25 18:45 ` [Bug libstdc++/60658] " redi at gcc dot gnu.org
@ 2014-03-25 19:17 ` redi at gcc dot gnu.org
  2014-03-25 19:29 ` [Bug libstdc++/60658] [4.7/4.8/4.9 Regression] " redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-25 19:17 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org


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

* [Bug libstdc++/60658] [4.7/4.8/4.9 Regression] std::atomic<T*> is unexpectedly not lock-free
  2014-03-25 17:07 [Bug libstdc++/60658] New: std::atomic<T*> is unexpectedly not lock-free ppluzhnikov at google dot com
  2014-03-25 18:45 ` [Bug libstdc++/60658] " redi at gcc dot gnu.org
  2014-03-25 19:17 ` redi at gcc dot gnu.org
@ 2014-03-25 19:29 ` redi at gcc dot gnu.org
  2014-03-25 19:40 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-25 19:29 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.6.3
   Target Milestone|---                         |4.7.4
            Summary|std::atomic<T*> is          |[4.7/4.8/4.9 Regression]
                   |unexpectedly not lock-free  |std::atomic<T*> is
                   |                            |unexpectedly not lock-free

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is a regression in all active branches


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

* [Bug libstdc++/60658] [4.7/4.8/4.9 Regression] std::atomic<T*> is unexpectedly not lock-free
  2014-03-25 17:07 [Bug libstdc++/60658] New: std::atomic<T*> is unexpectedly not lock-free ppluzhnikov at google dot com
                   ` (2 preceding siblings ...)
  2014-03-25 19:29 ` [Bug libstdc++/60658] [4.7/4.8/4.9 Regression] " redi at gcc dot gnu.org
@ 2014-03-25 19:40 ` redi at gcc dot gnu.org
  2014-03-25 20:14 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-25 19:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Tue Mar 25 19:39:52 2014
New Revision: 208819

URL: http://gcc.gnu.org/viewcvs?rev=208819&root=gcc&view=rev
Log:
    PR libstdc++/60658
    * include/bits/atomic_base.h (__atomic_base<_PTp*>::is_lock_free()):
    Use sizeof pointer type not the element type.
    * testsuite/29_atomics/atomic/60658.cc: New.

Added:
    trunk/libstdc++-v3/testsuite/29_atomics/atomic/60658.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/atomic_base.h


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

* [Bug libstdc++/60658] [4.7/4.8/4.9 Regression] std::atomic<T*> is unexpectedly not lock-free
  2014-03-25 17:07 [Bug libstdc++/60658] New: std::atomic<T*> is unexpectedly not lock-free ppluzhnikov at google dot com
                   ` (3 preceding siblings ...)
  2014-03-25 19:40 ` redi at gcc dot gnu.org
@ 2014-03-25 20:14 ` redi at gcc dot gnu.org
  2014-03-25 20:40 ` redi at gcc dot gnu.org
  2014-03-25 20:42 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-25 20:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Tue Mar 25 20:13:46 2014
New Revision: 208820

URL: http://gcc.gnu.org/viewcvs?rev=208820&root=gcc&view=rev
Log:
    PR libstdc++/60658
    * include/bits/atomic_base.h (__atomic_base<_PTp*>::is_lock_free()):
    Use sizeof pointer type not the element type.
    * testsuite/29_atomics/atomic/60658.cc: New.

    PR libstdc++/60658
    * include/bits/atomic_base.h (__atomic_base<_PTp*>::is_lock_free()):
    Use sizeof pointer type not the element type.
    * testsuite/29_atomics/atomic/60658.cc: New.

Added:
    branches/gcc-4_8-branch/libstdc++-v3/testsuite/29_atomics/atomic/60658.cc
Modified:
    branches/gcc-4_8-branch/libstdc++-v3/ChangeLog
    branches/gcc-4_8-branch/libstdc++-v3/include/bits/atomic_base.h


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

* [Bug libstdc++/60658] [4.7/4.8/4.9 Regression] std::atomic<T*> is unexpectedly not lock-free
  2014-03-25 17:07 [Bug libstdc++/60658] New: std::atomic<T*> is unexpectedly not lock-free ppluzhnikov at google dot com
                   ` (4 preceding siblings ...)
  2014-03-25 20:14 ` redi at gcc dot gnu.org
@ 2014-03-25 20:40 ` redi at gcc dot gnu.org
  2014-03-25 20:42 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-25 20:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Tue Mar 25 20:40:17 2014
New Revision: 208821

URL: http://gcc.gnu.org/viewcvs?rev=208821&root=gcc&view=rev
Log:
    PR libstdc++/60658
    * include/bits/atomic_base.h (__atomic_base<_PTp*>::is_lock_free()):
    Use sizeof pointer type not the element type.
    * testsuite/29_atomics/atomic/60658.cc: New.

Added:
    branches/gcc-4_7-branch/libstdc++-v3/testsuite/29_atomics/atomic/60658.cc
Modified:
    branches/gcc-4_7-branch/libstdc++-v3/ChangeLog
    branches/gcc-4_7-branch/libstdc++-v3/include/bits/atomic_base.h


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

* [Bug libstdc++/60658] [4.7/4.8/4.9 Regression] std::atomic<T*> is unexpectedly not lock-free
  2014-03-25 17:07 [Bug libstdc++/60658] New: std::atomic<T*> is unexpectedly not lock-free ppluzhnikov at google dot com
                   ` (5 preceding siblings ...)
  2014-03-25 20:40 ` redi at gcc dot gnu.org
@ 2014-03-25 20:42 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-25 20:42 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
      Known to fail|                            |4.7.3, 4.8.2

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 4.7.4, 4.8.3 and 4.9.0


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

end of thread, other threads:[~2014-03-25 20:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-25 17:07 [Bug libstdc++/60658] New: std::atomic<T*> is unexpectedly not lock-free ppluzhnikov at google dot com
2014-03-25 18:45 ` [Bug libstdc++/60658] " redi at gcc dot gnu.org
2014-03-25 19:17 ` redi at gcc dot gnu.org
2014-03-25 19:29 ` [Bug libstdc++/60658] [4.7/4.8/4.9 Regression] " redi at gcc dot gnu.org
2014-03-25 19:40 ` redi at gcc dot gnu.org
2014-03-25 20:14 ` redi at gcc dot gnu.org
2014-03-25 20:40 ` redi at gcc dot gnu.org
2014-03-25 20:42 ` redi 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).