[Bug sanitizer/57507] gcc 4.8: thread sanitizer: std::thread false(?) positive

2021-12-05 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57507

Andrew Pinski  changed:

   What|Removed |Added

 CC||p.bartosiewi at partner dot 
samsun
   ||g.com

--- Comment #6 from Andrew Pinski  ---
*** Bug 64337 has been marked as a duplicate of this bug. ***

[Bug sanitizer/57507] gcc 4.8: thread sanitizer: std::thread false(?) positive

2021-12-05 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57507

Andrew Pinski  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=65393

--- Comment #5 from Andrew Pinski  ---
(In reply to Jonathan Wakely from comment #4)
> This should no longer be a problem, because std::thread doesn't use
> std::shared_ptr these days.

Which is/was PR 65393.

[Bug sanitizer/57507] gcc 4.8: thread sanitizer: std::thread false(?) positive

2017-01-04 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57507

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |6.0

--- Comment #4 from Jonathan Wakely  ---
This should no longer be a problem, because std::thread doesn't use
std::shared_ptr these days.

[Bug sanitizer/57507] gcc 4.8: thread sanitizer: std::thread false(?) positive

2013-06-03 Thread kcc at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57507

--- Comment #1 from Kostya Serebryany kcc at gcc dot gnu.org ---
FTR: we don't yet officially support C++11 treads, so this is quite expected.
Patches and tests (to the upstream repo) are welcome


[Bug sanitizer/57507] gcc 4.8: thread sanitizer: std::thread false(?) positive

2013-06-03 Thread redi at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57507

--- Comment #2 from Jonathan Wakely redi at gcc dot gnu.org ---
Would supporting std::shared_ptr solve the problem?  The problem seems to be
due to not understanding that the atomic ops used by shared_ptr are atomic.


[Bug sanitizer/57507] gcc 4.8: thread sanitizer: std::thread false(?) positive

2013-06-03 Thread dvyukov at google dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57507

Dmitry Vyukov dvyukov at google dot com changed:

   What|Removed |Added

 CC||dvyukov at google dot com

--- Comment #3 from Dmitry Vyukov dvyukov at google dot com ---
The problem is that libstdc++ is not instrumented. It makes atomic accesses to
the shared_ptr that tsan does not see.

Here are the only events related to address that tsan sees (the first number is
thread id):

#0: alloc(48) = 0x7d0cefd0
#0: MemoryAccess: @0x7f5094bb5021 0x7d0cefd0 size=8 is_write=0
shadow_mem=0x0433bf40 {402418, 0, 0, 0}
#0: __tsan_atomic32_fetch_add(0x7d0cefd8, 4)
#0: MemoryAccess: @0x7f5094bcd8d4 0x7d0cefd8 size=4 is_write=1
shadow_mem=0x0433bf60 {402418, 0, 0, 0}
#1: free(0x7d0cefd0)
#1: MemoryAccessRange: @0x7f5094bb6c27 0x7d0cefd0 size=48 is_write=1
  Write of size 8 at 0x7d0cefd8 by thread T1:
  Previous atomic write of size 4 at 0x7d0cefd8 by main thread:
  Location is heap block of size 48 at 0x7d0cefd0 allocated by main thread:

And here the stack where we detect the race:

#0  __tsan::ReportRace (thr=0x7f8a1c35e800) at tsan_rtl_report.cc:596
#1  0x7f8a1c520565 in __tsan::__tsan_report_race () at tsan_rtl.cc:351
#2  0x7f8a1c5205b8 in __tsan::HandleRace (thr=0x7f8a1c35e800,
shadow_mem=0x433bf60, cur=..., old=...) at tsan_rtl.cc:378
#3  0x7f8a1c5381a3 in __tsan::MemoryAccessImpl (thr=0x7f8a1c35e800,
addr=137490493140952, kAccessSizeLog=3, kAccessIsWrite=true, kIsAtomic=false,
shadow_mem=0x433bf60, cur=...)
at tsan_rtl.cc:462
#4  0x7f8a1c5438ca in __tsan::MemoryAccessRange (thr=0x7f8a1c35e800,
pc=140231157189671, addr=137490493140952, size=40, is_write=true) at
tsan_rtl_thread.cc:363
#5  0x7f8a1c522952 in __tsan::MemoryRangeFreed (thr=0x7f8a1c35e800,
pc=140231157189671, addr=137490493140944, size=48) at tsan_rtl.cc:607
#6  0x7f8a1c5187e6 in __tsan::user_free (thr=0x7f8a1c35e800,
pc=140231157189671, p=0x7d0cefd0) at tsan_mman.cc:138
#7  0x7f8a1c4f8c4b in operator delete (ptr=0x7d0cefd0) at
tsan_interceptors.cc:519
#8  0x7f8a1c4f61ee in
__gnu_cxx::new_allocatorstd::_Sp_counted_ptr_inplacestd::thread::_Implstd::_Bind_simplemain(int,
char**)::lambda()() ,
std::allocatorstd::thread::_Implstd::_Bind_simplemain(int,
char**)::lambda()()  , (__gnu_cxx::_Lock_policy)2u
::deallocate(__gnu_cxx::new_allocatorstd::_Sp_counted_ptr_inplacestd::thread::_Implstd::_Bind_simplemain(int,
char**)::lambda()() ,
std::allocatorstd::thread::_Implstd::_Bind_simplemain(int,
char**)::lambda()()  , (__gnu_cxx::_Lock_policy)2u ::pointer,
__gnu_cxx::new_allocatorstd::_Sp_counted_ptr_inplacestd::thread::_Implstd::_Bind_simplemain(int,
char**)::lambda()() ,
std::allocatorstd::thread::_Implstd::_Bind_simplemain(int,
char**)::lambda()()  , (__gnu_cxx::_Lock_policy)2u ::size_type)
(this=0x7f8a1c35de4f, __p=0x7d0cefd0) at
gccinstall/include/c++/4.9.0/ext/new_allocator.h:110
#9  0x7f8a1c4f60dd in
std::allocator_traitsstd::allocatorstd::_Sp_counted_ptr_inplacestd::thread::_Implstd::_Bind_simplemain(int,
char**)::lambda()() ,
std::allocatorstd::thread::_Implstd::_Bind_simplemain(int,
char**)::lambda()()  , (__gnu_cxx::_Lock_policy)2u 
::deallocate(std::allocatorstd::_Sp_counted_ptr_inplacestd::thread::_Implstd::_Bind_simplemain(int,
char**)::lambda()() ,
std::allocatorstd::thread::_Implstd::_Bind_simplemain(int,
char**)::lambda()()  , (__gnu_cxx::_Lock_policy)2u  ,
std::allocator_traitsstd::allocatorstd::_Sp_counted_ptr_inplacestd::thread::_Implstd::_Bind_simplemain(int,
char**)::lambda()() ,
std::allocatorstd::thread::_Implstd::_Bind_simplemain(int,
char**)::lambda()()  , (__gnu_cxx::_Lock_policy)2u  ::pointer,
std::allocator_traitsstd::allocatorstd::_Sp_counted_ptr_inplacestd::thread::_Implstd::_Bind_simplemain(int,
char**)::lambda()() ,
std::allocatorstd::thread::_Implstd::_Bind_simplemain(int,
char**)::lambda()()  , (__gnu_cxx::_Lock_policy)2u  ::size_type)
(__a=..., __p=0x7d0cefd0, __n=1)
at gccinstall/include/c++/4.9.0/bits/alloc_traits.h:377
#10 0x7f8a1c4f6855 in
std::_Sp_counted_ptr_inplacestd::thread::_Implstd::_Bind_simplemain(int,
char**)::lambda()() ,
std::allocatorstd::thread::_Implstd::_Bind_simplemain(int,
char**)::lambda()()  , (__gnu_cxx::_Lock_policy)2u::_M_destroy(void)
(this=0x7d0cefd0) at
gccinstall/include/c++/4.9.0/bits/shared_ptr_base.h:454
#11 0x7f8a1bc56e7b in _M_release (this=0x7d0cefd0) at
gccbuild/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/shared_ptr_base.h:163
#12 ~__shared_count (this=synthetic pointer, __in_chrg=optimized out)
at
gccbuild/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/shared_ptr_base.h:589
#13 ~__shared_ptr (this=synthetic pointer, __in_chrg=optimized out)
at
gccbuild/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/shared_ptr_base.h:846
#14 ~shared_ptr