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