https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64265
Bug ID: 64265 Summary: r217669 broke tsan Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: bernd.edlinger at hotmail dot de Created attachment 34249 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34249&action=edit test case starting with r217669 tsan instrumentation gets wrong code: g++ -g -fsanitize=thread test.cpp ./a.out => soaks all memory up. reason is this function calls __tsan_func_entry in a loop: _ZNSt12_Destroy_auxILb0EE9__destroyIN9__gnu_cxx17__normal_iteratorIPSsSt6vectorISsSaISsEEEEEEvT_S9_: .LFB982: .loc 5 100 0 .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movq %rdi, -16(%rbp) movq %rsi, -32(%rbp) .L153: movq 8(%rbp), %rax movq %rax, %rdi call __tsan_func_entry .loc 5 102 0 discriminator 2 leaq -32(%rbp), %rdx leaq -16(%rbp), %rax movq %rdx, %rsi movq %rax, %rdi call _ZN9__gnu_cxxneIPSsSt6vectorISsSaISsEEEEbRKNS_17__normal_iteratorIT_T0_EESA_ testb %al, %al je .L152 .loc 5 103 0 discriminator 1 leaq -16(%rbp), %rax movq %rax, %rdi call _ZNK9__gnu_cxx17__normal_iteratorIPSsSt6vectorISsSaISsEEEdeEv movq %rax, %rdi call _ZSt11__addressofISsEPT_RS0_ movq %rax, %rdi call _ZSt8_DestroyISsEvPT_ .loc 5 102 0 discriminator 1 leaq -16(%rbp), %rax movq %rax, %rdi call _ZN9__gnu_cxx17__normal_iteratorIPSsSt6vectorISsSaISsEEEppEv jmp .L153 .L152: .loc 5 104 0 call __tsan_func_exit leave .cfi_def_cfa 7, 8 ret .cfi_endproc it is generated from bits/stl_container.h, line 95-105: template<bool> struct _Destroy_aux { template<typename _ForwardIterator> static void __destroy(_ForwardIterator __first, _ForwardIterator __last) { for (; __first != __last; ++__first) std::_Destroy(std::__addressof(*__first)); } };