public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/59215] New: tsan: warning in shared_ptr_base.h
@ 2013-11-20 16:38 oleg at smolsky dot net
  2013-11-20 16:44 ` [Bug sanitizer/59215] " kcc at gcc dot gnu.org
                   ` (21 more replies)
  0 siblings, 22 replies; 23+ messages in thread
From: oleg at smolsky dot net @ 2013-11-20 16:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59215
           Summary: tsan: warning in shared_ptr_base.h
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: oleg at smolsky dot net
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org

I just got what appears to be a false positive in GCC's own implementation of
shared_ptr ref counts:

Read of size 4 by thread T21:
  #0 _M_add_ref_lock ...gcc/include/c++/4.8.x-google/bits/shared_ptr_base.h:236

Previous atomic write of size 4 by main thread:
  #0 __tsan_atomic32_fetch_add ??:0 (libtsan.so.0+0x00000000d3e5)
  #1 __exchange_and_add_dispatch
...gcc/include/c++/4.8.x-google/ext/atomicity.h:49
  ....

The atomic write is obvious - it's an "up ref". The read, however, should have
just worked as the variable is (well, is supposed to be) atomic.

I don't get it... is the tool missing the atomic manipulation? Or is the
library missing the correct annotation? I'm leaning towards the latter:

in ...gcc/include/c++/4.8.x-google/x86_64-unknown-linux/bits/atomic_word.h

       typedef int _Atomic_word;

Should this be std::atomic<int> ?


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

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

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-20 16:38 [Bug sanitizer/59215] New: tsan: warning in shared_ptr_base.h oleg at smolsky dot net
2013-11-20 16:44 ` [Bug sanitizer/59215] " kcc at gcc dot gnu.org
2013-11-20 16:53 ` oleg at smolsky dot net
2013-11-20 17:04 ` kcc at gcc dot gnu.org
2013-11-20 17:56 ` redi at gcc dot gnu.org
2013-11-20 18:00 ` kcc at gcc dot gnu.org
2013-11-20 18:04 ` redi at gcc dot gnu.org
2013-11-20 18:05 ` redi at gcc dot gnu.org
2013-11-20 18:09 ` kcc at gcc dot gnu.org
2013-11-20 18:15 ` oleg at smolsky dot net
2013-11-20 18:30 ` redi at gcc dot gnu.org
2013-11-20 18:32 ` kcc at gcc dot gnu.org
2013-11-20 18:43 ` oleg at smolsky dot net
2013-11-20 18:55 ` kcc at gcc dot gnu.org
2013-11-21  8:06 ` kcc at gcc dot gnu.org
2013-11-21 12:31 ` dvyukov at google dot com
2013-11-21 14:47 ` [Bug libstdc++/59215] " redi at gcc dot gnu.org
2013-11-21 14:55 ` Joost.VandeVondele at mat dot ethz.ch
2013-11-22 12:38 ` redi at gcc dot gnu.org
2013-11-22 16:02 ` oleg at smolsky dot net
2014-01-27 17:57 ` redi at gcc dot gnu.org
2014-01-27 17:59 ` redi at gcc dot gnu.org
2014-03-11 19: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).