This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug sanitizer/68260] false positive with tsan
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 06 Sep 2016 06:16:22 +0000
- Subject: [Bug sanitizer/68260] false positive with tsan
- Auto-submitted: auto-generated
- References: <bug-68260-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68260
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Dmitry Vyukov from comment #1)
> gcc does not instrument atomic operations:
>
> 00000000004a73d0 <_ZN4spin6unlockEv>:
>
> void unlock() { flag.clear(std::memory_order_release); }
> 4a73d0: 55 push %rbp
> 4a73d1: 48 89 e5 mov %rsp,%rbp
> 4a73d4: 48 83 ec 10 sub $0x10,%rsp
> 4a73d8: 48 8b 45 08 mov 0x8(%rbp),%rax
> 4a73dc: 48 89 7d f0 mov %rdi,-0x10(%rbp)
> 4a73e0: 48 89 c7 mov %rax,%rdi
> 4a73e3: e8 68 4f fd ff callq 47c350 <__tsan_func_entry>
> 4a73e8: be 03 00 00 00 mov $0x3,%esi
> 4a73ed: 48 8b 45 f0 mov -0x10(%rbp),%rax
> 4a73f1: 48 89 45 f8 mov %rax,-0x8(%rbp)
> 4a73f5: 48 8b 7d f8 mov -0x8(%rbp),%rdi
> 4a73f9: e8 62 02 00 00 callq 4a7660
> <_ZNSt11atomic_flag5clearESt12memory_order>
> 4a73fe: e8 fd 4f fd ff callq 47c400 <__tsan_func_exit>
> 4a7403: 48 83 c4 10 add $0x10,%rsp
> 4a7407: 5d pop %rbp
> 4a7408: c3 retq
>
>
>
> FWIW this programs works fine with clang.
Actually I wonder if _ZNSt11atomic_flag5clearESt12memory_order is instrumented
but the one being chose by the linker is not. ODR issues :)