http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59215
--- Comment #20 from Oleg Smolsky <oleg at smolsky dot net> ---
Hey Jonathan, here is the output:
Read of size 4 at 0x7d0400005008 by main thread (mutexes: write
M2344, write M132):
#0 _M_add_ref_lock
..../gcc48/include/c++/4.8.x-google/bits/shared_ptr_base.h:236
(exe+0x000000d0ae09)
#1 my code (a)
Previous atomic write of size 4 at 0x7d0400005008 by thread T21
(mutexes: write M4016):
#0 __tsan_atomic32_fetch_add ??:0 (libtsan.so.0+0x00000000d3e5)
#1 __exchange_and_add_dispatch
/mnt/project/granite/toolchains/elixir/rvbd-gcc48/include/c++/4.8.x-google/ext/atomicity.h:49
(exe+0x0000003d7738)
#2 handle_event(....)
.../gcc48/include/c++/4.8.x-google/bits/shared_ptr_base.h:546 (
this is my code (b)
(a) string x = config()->iscsi().dc_initiator().name();
this thing very quickly copies a shared_ptr instance, dereferences it,
gets to a sub-object, gets a field and then destructs.
(b) is a shared_ptr copy too, but it is obscured by heavy inlining