check-tsan fails

Executive summary:

The `ninja check-tsan` causes 5 failures after building
llvm;clang;compiler-rt. I looked
at one of the failures, memcpy_race.cc, and the problem appears to be
that memcpy_race.cc
expects the stack to have only 2 stack frame elements when the race is
detected. But the
clang that I built causes tsan to have 3 stack frames and thus the failure(s).

Why is the clang I built have 3 stack frame elements when detecting a
race using tsan?

I'm on an Arch Linux machine:
$ uname -a
Linux wink-desktop 5.0.10-arch1-1-ARCH #1 SMP PREEMPT Sat Apr 27
20:06:45 UTC 2019 x86_64 GNU/Linux

With gcc version:
$ gcc --version
gcc (GCC) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

And I compiling master:
$ git log -1
commit 0460a3629b2564d9b34702ba05ab3f461533eca9 (HEAD -> master,
upstream/master, origin/master, origin/HEAD)
Author: Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net>

    [MCA] Notify event listeners when instructions transition to the
Pending state. NFCI

    llvm-svn: 359983

Configured with cmake:
$ cmake ../llvm -G Ninja
'-DLLVM_ENABLE_PROJECTS=clang;lld;compiler-rt'
-DCMAKE_INSTALL_PREFIX=/home/wink/local-llvm-clang-compiler-rt-master-0460a3629b2-use-ld-bfd
-DCMAKE_BUILD_TYPE=Release -DLLVM_USE_LINKER=bfd
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- clang project is enabled
-- clang-tools-extra project is disabled
-- compiler-rt project is enabled
-- debuginfo-tests project is disabled
-- libclc project is disabled
-- libcxx project is disabled
-- libcxxabi project is disabled
-- libunwind project is disabled
-- lld project is enabled
-- lldb project is disabled
-- llgo project is disabled
-- openmp project is disabled
-- parallel-libs project is disabled
-- polly project is disabled
-- pstl project is disabled
-- Found Z3: /usr/lib/libz3.so (found suitable version "4.8.4",
minimum required is "4.7.1")
-- Looking for dlfcn.h
-- Looking for dlfcn.h - found
-- Looking for errno.h
-- Looking for errno.h - found
-- Looking for fcntl.h
-- Looking for fcntl.h - found
-- Looking for link.h
-- Looking for link.h - found
-- Looking for malloc/malloc.h
-- Looking for malloc/malloc.h - not found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for signal.h
-- Looking for signal.h - found
-- Looking for sys/ioctl.h
-- Looking for sys/ioctl.h - found
-- Looking for sys/mman.h
-- Looking for sys/mman.h - found
-- Looking for sys/param.h
-- Looking for sys/param.h - found
-- Looking for sys/resource.h
-- Looking for sys/resource.h - found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for sys/time.h
-- Looking for sys/time.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for termios.h
-- Looking for termios.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for valgrind/valgrind.h
-- Looking for valgrind/valgrind.h - found
-- Looking for zlib.h
-- Looking for zlib.h - found
-- Looking for fenv.h
-- Looking for fenv.h - found
-- Looking for FE_ALL_EXCEPT
-- Looking for FE_ALL_EXCEPT - found
-- Looking for FE_INEXACT
-- Looking for FE_INEXACT - found
-- Looking for mach/mach.h
-- Looking for mach/mach.h - not found
-- Looking for histedit.h
-- Looking for histedit.h - found
-- Looking for CrashReporterClient.h
-- Looking for CrashReporterClient.h - not found
-- Looking for linux/magic.h
-- Looking for linux/magic.h - found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Looking for pthread_getspecific in pthread
-- Looking for pthread_getspecific in pthread - found
-- Looking for pthread_rwlock_init in pthread
-- Looking for pthread_rwlock_init in pthread - found
-- Looking for pthread_mutex_lock in pthread
-- Looking for pthread_mutex_lock in pthread - found
-- Looking for dlopen in dl
-- Looking for dlopen in dl - found
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - found
-- Looking for pfm_initialize in pfm
-- Looking for pfm_initialize in pfm - not found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Looking for compress2 in z
-- Looking for compress2 in z - found
-- Looking for el_init in edit
-- Looking for el_init in edit - found
-- Looking for setupterm in terminfo
-- Looking for setupterm in terminfo - not found
-- Looking for setupterm in tinfo
-- Looking for setupterm in tinfo - found
-- Found LibXml2: /usr/lib/libxml2.so (found version "2.9.9")
-- Looking for xar_open in xar
-- Looking for xar_open in xar - not found
-- Looking for arc4random
-- Looking for arc4random - not found
-- Looking for backtrace
-- Looking for backtrace - found
-- backtrace facility detected in default set of libraries
-- Found Backtrace: /usr/include
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
-- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Failed
-- Looking for _Unwind_Backtrace
-- Looking for _Unwind_Backtrace - found
-- Looking for getpagesize
-- Looking for getpagesize - found
-- Looking for sysconf
-- Looking for sysconf - found
-- Looking for getrusage
-- Looking for getrusage - found
-- Looking for setrlimit
-- Looking for setrlimit - found
-- Looking for isatty
-- Looking for isatty - found
-- Looking for futimens
-- Looking for futimens - found
-- Looking for futimes
-- Looking for futimes - found
-- Looking for posix_fallocate
-- Looking for posix_fallocate - found
-- Looking for sigaltstack
-- Looking for sigaltstack - found
-- Looking for lseek64
-- Looking for lseek64 - found
-- Looking for mallctl
-- Looking for mallctl - not found
-- Looking for mallinfo
-- Looking for mallinfo - found
-- Looking for malloc_zone_statistics
-- Looking for malloc_zone_statistics - not found
-- Looking for getrlimit
-- Looking for getrlimit - found
-- Looking for posix_spawn
-- Looking for posix_spawn - found
-- Looking for pread
-- Looking for pread - found
-- Looking for sbrk
-- Looking for sbrk - found
-- Looking for strerror
-- Looking for strerror - found
-- Looking for strerror_r
-- Looking for strerror_r - found
-- Looking for strerror_s
-- Looking for strerror_s - not found
-- Looking for setenv
-- Looking for setenv - found
-- Looking for dlopen
-- Looking for dlopen - found
-- Looking for dladdr
-- Looking for dladdr - not found
-- Performing Test HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
-- Performing Test HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC - Failed
-- Performing Test HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
-- Performing Test HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC - Success
-- Looking for __GLIBC__
-- Looking for __GLIBC__ - found
-- Looking for sched_getaffinity
-- Looking for sched_getaffinity - found
-- Looking for CPU_COUNT
-- Looking for CPU_COUNT - found
-- Looking for pthread_getname_np
-- Looking for pthread_getname_np - found
-- Looking for pthread_setname_np
-- Looking for pthread_setname_np - found
-- Performing Test HAVE_STD_IS_TRIVIALLY_COPYABLE
-- Performing Test HAVE_STD_IS_TRIVIALLY_COPYABLE - Success
-- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB
-- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB - Success
-- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB
-- Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB - Success
-- Performing Test LLVM_HAS_ATOMICS
-- Performing Test LLVM_HAS_ATOMICS - Success
-- Performing Test SUPPORTS_VARIADIC_MACROS_FLAG
-- Performing Test SUPPORTS_VARIADIC_MACROS_FLAG - Success
-- Performing Test SUPPORTS_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS_FLAG
-- Performing Test SUPPORTS_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS_FLAG - Failed
-- Performing Test HAS_MAYBE_UNINITIALIZED
-- Performing Test HAS_MAYBE_UNINITIALIZED - Success
-- Native target architecture is X86
-- Threads enabled.
-- Doxygen disabled.
-- Go bindings enabled.
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)
-- OCaml bindings disabled.
-- Could NOT find Python module pygments
-- Could NOT find Python module pygments.lexers.c_cpp
-- Could NOT find Python module yaml
-- LLVM host triple: x86_64-unknown-linux-gnu
-- LLVM default target triple: x86_64-unknown-linux-gnu
-- Performing Test CXX_SUPPORTS_CUSTOM_LINKER
-- Performing Test CXX_SUPPORTS_CUSTOM_LINKER - Success
-- Performing Test C_SUPPORTS_FPIC
-- Performing Test C_SUPPORTS_FPIC - Success
-- Performing Test CXX_SUPPORTS_FPIC
-- Performing Test CXX_SUPPORTS_FPIC - Success
-- Building with -fPIC
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG
-- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success
-- Performing Test C_SUPPORTS_WERROR_DATE_TIME
-- Performing Test C_SUPPORTS_WERROR_DATE_TIME - Success
-- Performing Test CXX_SUPPORTS_WERROR_DATE_TIME
-- Performing Test CXX_SUPPORTS_WERROR_DATE_TIME - Success
-- Performing Test CXX_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW
-- Performing Test CXX_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Failed
-- Performing Test CXX_SUPPORTS_CXX_STD
-- Performing Test CXX_SUPPORTS_CXX_STD - Success
-- Performing Test CXX_SUPPORTS_MISSING_FIELD_INITIALIZERS_FLAG
-- Performing Test CXX_SUPPORTS_MISSING_FIELD_INITIALIZERS_FLAG - Success
-- Performing Test C_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG
-- Performing Test C_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG - Success
-- Performing Test CXX_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG
-- Performing Test CXX_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG - Success
-- Performing Test C_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG
-- Performing Test C_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG - Failed
-- Performing Test CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG
-- Performing Test CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG - Failed
-- Performing Test CXX_SUPPORTS_CLASS_MEMACCESS_FLAG
-- Performing Test CXX_SUPPORTS_CLASS_MEMACCESS_FLAG - Success
-- Performing Test CXX_SUPPORTS_NOEXCEPT_TYPE_FLAG
-- Performing Test CXX_SUPPORTS_NOEXCEPT_TYPE_FLAG - Success
-- Performing Test C_SUPPORTS_DELETE_NON_VIRTUAL_DTOR_FLAG
-- Performing Test C_SUPPORTS_DELETE_NON_VIRTUAL_DTOR_FLAG - Failed
-- Performing Test CXX_SUPPORTS_DELETE_NON_VIRTUAL_DTOR_FLAG
-- Performing Test CXX_SUPPORTS_DELETE_NON_VIRTUAL_DTOR_FLAG - Success
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP
-- Performing Test C_WCOMMENT_ALLOWS_LINE_WRAP - Failed
-- Performing Test C_SUPPORTS_STRING_CONVERSION_FLAG
-- Performing Test C_SUPPORTS_STRING_CONVERSION_FLAG - Failed
-- Performing Test CXX_SUPPORTS_STRING_CONVERSION_FLAG
-- Performing Test CXX_SUPPORTS_STRING_CONVERSION_FLAG - Failed
-- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS
-- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS - Failed
-- Performing Test C_SUPPORTS_FNO_FUNCTION_SECTIONS
-- Performing Test C_SUPPORTS_FNO_FUNCTION_SECTIONS - Success
-- Performing Test C_SUPPORTS_FFUNCTION_SECTIONS
-- Performing Test C_SUPPORTS_FFUNCTION_SECTIONS - Success
-- Performing Test CXX_SUPPORTS_FFUNCTION_SECTIONS
-- Performing Test CXX_SUPPORTS_FFUNCTION_SECTIONS - Success
-- Performing Test C_SUPPORTS_FDATA_SECTIONS
-- Performing Test C_SUPPORTS_FDATA_SECTIONS - Success
-- Performing Test CXX_SUPPORTS_FDATA_SECTIONS
-- Performing Test CXX_SUPPORTS_FDATA_SECTIONS - Success
-- Looking for os_signpost_interval_begin
-- Looking for os_signpost_interval_begin - not found
-- Found PythonInterp: /usr/bin/python2.7 (found version "2.7.16")
-- Constructing LLVMBuild project information
-- Found Git: /usr/bin/git (found version "2.21.0")
-- Linker detection: GNU ld
-- Targeting AArch64
-- Targeting AMDGPU
-- Targeting ARM
-- Targeting BPF
-- Targeting Hexagon
-- Targeting Lanai
-- Targeting Mips
-- Targeting MSP430
-- Targeting NVPTX
-- Targeting PowerPC
-- Targeting Sparc
-- Targeting SystemZ
-- Targeting WebAssembly
-- Targeting X86
-- Targeting XCore
-- Looking for unwind.h
CMake Warning (dev) at
/usr/share/cmake-3.14/Modules/CheckIncludeFile.cmake:80 (message):
  Policy CMP0075 is not set: Include file check macros honor
  CMAKE_REQUIRED_LIBRARIES. Run "cmake --help-policy CMP0075" for policy
  details. Use the cmake_policy command to set the policy and suppress this
  warning.

  CMAKE_REQUIRED_LIBRARIES is set to:

    m

  For compatibility with CMake 3.11 and below this check is ignoring it.
Call Stack (most recent call first):
  /home/wink/prgs/llvm/llvm-project/compiler-rt/cmake/base-config-ix.cmake:9
(check_include_file)
  /home/wink/prgs/llvm/llvm-project/compiler-rt/CMakeLists.txt:27 (include)
This warning is for project developers. Use -Wno-dev to suppress it.

-- Looking for unwind.h - found
-- Looking for rpc/xdr.h
-- Looking for rpc/xdr.h - not found
CMake Warning (dev) at
/home/wink/prgs/llvm/llvm-project/compiler-rt/CMakeLists.txt:64 (set):
  implicitly converting 'BOOLEAN' to 'STRING' type.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at
/home/wink/prgs/llvm/llvm-project/compiler-rt/CMakeLists.txt:67 (set):
  implicitly converting 'BOOLEAN' to 'STRING' type.
This warning is for project developers. Use -Wno-dev to suppress it.

-- Looking for fopen in c
-- Looking for fopen in c - found
-- Looking for __gcc_personality_v0 in gcc_s
-- Looking for __gcc_personality_v0 in gcc_s - found
-- Performing Test COMPILER_RT_HAS_NODEFAULTLIBS_FLAG
-- Performing Test COMPILER_RT_HAS_NODEFAULTLIBS_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FFREESTANDING_FLAG
-- Performing Test COMPILER_RT_HAS_FFREESTANDING_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FPIC_FLAG
-- Performing Test COMPILER_RT_HAS_FPIC_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FPIE_FLAG
-- Performing Test COMPILER_RT_HAS_FPIE_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FNO_BUILTIN_FLAG
-- Performing Test COMPILER_RT_HAS_FNO_BUILTIN_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FNO_EXCEPTIONS_FLAG
-- Performing Test COMPILER_RT_HAS_FNO_EXCEPTIONS_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FOMIT_FRAME_POINTER_FLAG
-- Performing Test COMPILER_RT_HAS_FOMIT_FRAME_POINTER_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FUNWIND_TABLES_FLAG
-- Performing Test COMPILER_RT_HAS_FUNWIND_TABLES_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FNO_STACK_PROTECTOR_FLAG
-- Performing Test COMPILER_RT_HAS_FNO_STACK_PROTECTOR_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FNO_SANITIZE_SAFE_STACK_FLAG
-- Performing Test COMPILER_RT_HAS_FNO_SANITIZE_SAFE_STACK_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_FVISIBILITY_HIDDEN_FLAG
-- Performing Test COMPILER_RT_HAS_FVISIBILITY_HIDDEN_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FRTTI_FLAG
-- Performing Test COMPILER_RT_HAS_FRTTI_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FNO_RTTI_FLAG
-- Performing Test COMPILER_RT_HAS_FNO_RTTI_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG
-- Performing Test COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG - Success
-- Performing Test COMPILER_RT_HAS_STD_CXX11_FLAG
-- Performing Test COMPILER_RT_HAS_STD_CXX11_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC
-- Performing Test COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC - Success
-- Performing Test COMPILER_RT_HAS_FNO_LTO_FLAG
-- Performing Test COMPILER_RT_HAS_FNO_LTO_FLAG - Success
-- Performing Test COMPILER_RT_HAS_MSSE3_FLAG
-- Performing Test COMPILER_RT_HAS_MSSE3_FLAG - Success
-- Performing Test COMPILER_RT_HAS_MSSE4_2_FLAG
-- Performing Test COMPILER_RT_HAS_MSSE4_2_FLAG - Success
-- Performing Test COMPILER_RT_HAS_SYSROOT_FLAG
-- Performing Test COMPILER_RT_HAS_SYSROOT_FLAG - Success
-- Performing Test COMPILER_RT_HAS_MCRC_FLAG
-- Performing Test COMPILER_RT_HAS_MCRC_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_FVISIBILITY_INLINES_HIDDEN_FLAG
-- Performing Test COMPILER_RT_HAS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success
-- Performing Test COMPILER_RT_HAS_GR_FLAG
-- Performing Test COMPILER_RT_HAS_GR_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_GS_FLAG
-- Performing Test COMPILER_RT_HAS_GS_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_MT_FLAG
-- Performing Test COMPILER_RT_HAS_MT_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_Oy_FLAG
-- Performing Test COMPILER_RT_HAS_Oy_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_GLINE_TABLES_ONLY_FLAG
-- Performing Test COMPILER_RT_HAS_GLINE_TABLES_ONLY_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_G_FLAG
-- Performing Test COMPILER_RT_HAS_G_FLAG - Success
-- Performing Test COMPILER_RT_HAS_Zi_FLAG
-- Performing Test COMPILER_RT_HAS_Zi_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WALL_FLAG
-- Performing Test COMPILER_RT_HAS_WALL_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WERROR_FLAG
-- Performing Test COMPILER_RT_HAS_WERROR_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WFRAME_LARGER_THAN_FLAG
-- Performing Test COMPILER_RT_HAS_WFRAME_LARGER_THAN_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG
-- Performing Test COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WC99_EXTENSIONS_FLAG
-- Performing Test COMPILER_RT_HAS_WC99_EXTENSIONS_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WGNU_FLAG
-- Performing Test COMPILER_RT_HAS_WGNU_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WNON_VIRTUAL_DTOR_FLAG
-- Performing Test COMPILER_RT_HAS_WNON_VIRTUAL_DTOR_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG
-- Performing Test COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG
-- Performing Test COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG
-- Performing Test COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WNO_PEDANTIC
-- Performing Test COMPILER_RT_HAS_WNO_PEDANTIC - Success
-- Performing Test COMPILER_RT_HAS_W4_FLAG
-- Performing Test COMPILER_RT_HAS_W4_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WX_FLAG
-- Performing Test COMPILER_RT_HAS_WX_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WD4146_FLAG
-- Performing Test COMPILER_RT_HAS_WD4146_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WD4291_FLAG
-- Performing Test COMPILER_RT_HAS_WD4291_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WD4221_FLAG
-- Performing Test COMPILER_RT_HAS_WD4221_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WD4391_FLAG
-- Performing Test COMPILER_RT_HAS_WD4391_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WD4722_FLAG
-- Performing Test COMPILER_RT_HAS_WD4722_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WD4800_FLAG
-- Performing Test COMPILER_RT_HAS_WD4800_FLAG - Failed
-- Looking for __func__
-- Looking for __func__ - found
-- Looking for dlopen in dl
-- Looking for dlopen in dl - found
-- Looking for shm_open in rt
-- Looking for shm_open in rt - found
-- Looking for pow in m
-- Looking for pow in m - found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Looking for backtrace in execinfo
-- Looking for backtrace in execinfo - not found
-- Looking for setupterm in terminfo
-- Looking for setupterm in terminfo - not found
-- Looking for setupterm in tinfo
-- Looking for setupterm in tinfo - found
-- Looking for __cxa_throw in c++
-- Looking for __cxa_throw in c++ - not found
-- Looking for __cxa_throw in stdc++
-- Looking for __cxa_throw in stdc++ - found
-- Performing Test COMPILER_RT_HAS_Z_TEXT
-- Performing Test COMPILER_RT_HAS_Z_TEXT - Success
-- Looking for __i386__
-- Looking for __i386__ - not found
-- Compiler-RT supported architectures: x86_64
-- Performing Test COMPILER_RT_HAS_STD_C11_FLAG
-- Performing Test COMPILER_RT_HAS_STD_C11_FLAG - Success
-- Performing Test COMPILER_RT_HAS_VISIBILITY_HIDDEN_FLAG
-- Performing Test COMPILER_RT_HAS_VISIBILITY_HIDDEN_FLAG - Success
-- Performing Test COMPILER_RT_HAS_OMIT_FRAME_POINTER_FLAG
-- Performing Test COMPILER_RT_HAS_OMIT_FRAME_POINTER_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FREESTANDING_FLAG
-- Performing Test COMPILER_RT_HAS_FREESTANDING_FLAG - Success
-- Performing Test COMPILER_RT_HAS_XRAY_COMPILER_FLAG
-- Performing Test COMPILER_RT_HAS_XRAY_COMPILER_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_ATOMIC_KEYWORD
-- Performing Test COMPILER_RT_HAS_ATOMIC_KEYWORD - Success
-- Builtin supported architectures: x86_64
-- Performing Test COMPILER_RT_TARGET_HAS_ATOMICS
-- Performing Test COMPILER_RT_TARGET_HAS_ATOMICS - Success
-- Performing Test COMPILER_RT_TARGET_HAS_FCNTL_LCK
-- Performing Test COMPILER_RT_TARGET_HAS_FCNTL_LCK - Success
-- Performing Test COMPILER_RT_TARGET_HAS_UNAME
-- Performing Test COMPILER_RT_TARGET_HAS_UNAME - Success
-- Performing Test HAS_THREAD_LOCAL
-- Performing Test HAS_THREAD_LOCAL - Success
-- Linker detection: GNU ld
-- Linker detection: GNU ld
-- Builtin supported architectures: x86_64
-- Generated Sanitizer SUPPORTED_TOOLS list on "Linux" is
"asan;lsan;msan;tsan;ubsan"
-- sanitizer_common tests on "Linux" will run against
"asan;lsan;msan;tsan;ubsan"
-- check-shadowcallstack does nothing.
-- Looking for sys/resource.h
-- Looking for sys/resource.h - found
-- Clang version: 9.0.0
-- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG
-- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG - Failed
-- LLD version: 9.0.0
-- LLVM FileCheck Found: /usr/bin/FileCheck
-- git Version: v0.0.0
-- Version: 0.0.0
-- Performing Test HAVE_CXX_FLAG_STD_CXX11
-- Performing Test HAVE_CXX_FLAG_STD_CXX11 - Success
-- Performing Test HAVE_CXX_FLAG_WALL
-- Performing Test HAVE_CXX_FLAG_WALL - Success
-- Performing Test HAVE_CXX_FLAG_WEXTRA
-- Performing Test HAVE_CXX_FLAG_WEXTRA - Success
-- Performing Test HAVE_CXX_FLAG_WSHADOW
-- Performing Test HAVE_CXX_FLAG_WSHADOW - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC
-- Performing Test HAVE_CXX_FLAG_PEDANTIC - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS - Success
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32 - Failed
-- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL
-- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL - Success
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_FNO_EXCEPTIONS
-- Performing Test HAVE_CXX_FLAG_FNO_EXCEPTIONS - Success
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WD654
-- Performing Test HAVE_CXX_FLAG_WD654 - Failed
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY - Failed
-- Performing Test HAVE_CXX_FLAG_COVERAGE
-- Performing Test HAVE_CXX_FLAG_COVERAGE - Success
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX -- success
-- Performing Test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Configuring done
-- Generating done
-- Build files have been written to:
/home/wink/prgs/llvm/llvm-project/build-llvm-clang-compiler-rt-master-0460a3629b2-use-ld-bfd

And then I build:

$ ninja -j11 -v
[1/4348] /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-Ilib/Demangle -I/home/wink/prgs/llvm/llvm-project/llvm/lib/Demangle
-I/usr/include/libxml2 -Iinclude
-I/home/wink/prgs/llvm/llvm-project/llvm/include -fPIC
-fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -Wextra
-Wno-unused-parameter -Wwrite-strings -Wcast-qual
-Wno-missing-field-initializers -pedantic -Wno-long-long
-Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess
-Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment
-fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG
-fno-exceptions -fno-rtti -MD -MT
lib/Demangle/CMakeFiles/LLVMDemangle.dir/Demangle.cpp.o -MF
lib/Demangle/CMakeFiles/LLVMDemangle.dir/Demangle.cpp.o.d -o
lib/Demangle/CMakeFiles/LLVMDemangle.dir/Demangle.cpp.o -c
/home/wink/prgs/llvm/llvm-project/llvm/lib/Demangle/Demangle.cpp

...

[4348/4348] : && /usr/bin/c++ -fPIC -fvisibility-inlines-hidden
-Werror=date-time -std=c++11 -Wall -Wextra -Wno-unused-parameter
-Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic
-Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized
-Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor
-Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections
-O3 -DNDEBUG -fuse-ld=bfd -Wl,-allow-shlib-undefined
-Wl,--export-dynamic
-Wl,-rpath-link,/home/wink/prgs/llvm/llvm-project/build-llvm-clang-compiler-rt-master-0460a3629b2-use-ld-bfd/./lib
-Wl,-O3 tools/opt/CMakeFiles/opt.dir/AnalysisWrappers.cpp.o
tools/opt/CMakeFiles/opt.dir/BreakpointPrinter.cpp.o
tools/opt/CMakeFiles/opt.dir/Debugify.cpp.o
tools/opt/CMakeFiles/opt.dir/GraphPrinters.cpp.o
tools/opt/CMakeFiles/opt.dir/NewPMDriver.cpp.o
tools/opt/CMakeFiles/opt.dir/PassPrinters.cpp.o
tools/opt/CMakeFiles/opt.dir/PrintSCC.cpp.o
tools/opt/CMakeFiles/opt.dir/opt.cpp.o -o bin/opt
-Wl,-rpath,"\$ORIGIN/../lib" lib/libLLVMAArch64CodeGen.a
lib/libLLVMAArch64AsmParser.a lib/libLLVMAArch64AsmPrinter.a
lib/libLLVMAArch64Desc.a lib/libLLVMAArch64Disassembler.a
lib/libLLVMAArch64Info.a lib/libLLVMAArch64Utils.a
lib/libLLVMAMDGPUCodeGen.a lib/libLLVMAMDGPUAsmParser.a
lib/libLLVMAMDGPUAsmPrinter.a lib/libLLVMAMDGPUDesc.a
lib/libLLVMAMDGPUDisassembler.a lib/libLLVMAMDGPUInfo.a
lib/libLLVMAMDGPUUtils.a lib/libLLVMARMCodeGen.a
lib/libLLVMARMAsmParser.a lib/libLLVMARMAsmPrinter.a
lib/libLLVMARMDesc.a lib/libLLVMARMDisassembler.a lib/libLLVMARMInfo.a
lib/libLLVMARMUtils.a lib/libLLVMBPFCodeGen.a
lib/libLLVMBPFAsmParser.a lib/libLLVMBPFAsmPrinter.a
lib/libLLVMBPFDesc.a lib/libLLVMBPFDisassembler.a lib/libLLVMBPFInfo.a
lib/libLLVMHexagonCodeGen.a lib/libLLVMHexagonAsmParser.a
lib/libLLVMHexagonDesc.a lib/libLLVMHexagonDisassembler.a
lib/libLLVMHexagonInfo.a lib/libLLVMLanaiCodeGen.a
lib/libLLVMLanaiAsmParser.a lib/libLLVMLanaiAsmPrinter.a
lib/libLLVMLanaiDesc.a lib/libLLVMLanaiDisassembler.a
lib/libLLVMLanaiInfo.a lib/libLLVMMipsCodeGen.a
lib/libLLVMMipsAsmParser.a lib/libLLVMMipsAsmPrinter.a
lib/libLLVMMipsDesc.a lib/libLLVMMipsDisassembler.a
lib/libLLVMMipsInfo.a lib/libLLVMMSP430CodeGen.a
lib/libLLVMMSP430AsmParser.a lib/libLLVMMSP430AsmPrinter.a
lib/libLLVMMSP430Desc.a lib/libLLVMMSP430Disassembler.a
lib/libLLVMMSP430Info.a lib/libLLVMNVPTXCodeGen.a
lib/libLLVMNVPTXAsmPrinter.a lib/libLLVMNVPTXDesc.a
lib/libLLVMNVPTXInfo.a lib/libLLVMPowerPCCodeGen.a
lib/libLLVMPowerPCAsmParser.a lib/libLLVMPowerPCAsmPrinter.a
lib/libLLVMPowerPCDesc.a lib/libLLVMPowerPCDisassembler.a
lib/libLLVMPowerPCInfo.a lib/libLLVMSparcCodeGen.a
lib/libLLVMSparcAsmParser.a lib/libLLVMSparcAsmPrinter.a
lib/libLLVMSparcDesc.a lib/libLLVMSparcDisassembler.a
lib/libLLVMSparcInfo.a lib/libLLVMSystemZCodeGen.a
lib/libLLVMSystemZAsmParser.a lib/libLLVMSystemZAsmPrinter.a
lib/libLLVMSystemZDesc.a lib/libLLVMSystemZDisassembler.a
lib/libLLVMSystemZInfo.a lib/libLLVMWebAssemblyCodeGen.a
lib/libLLVMWebAssemblyAsmParser.a lib/libLLVMWebAssemblyAsmPrinter.a
lib/libLLVMWebAssemblyDesc.a lib/libLLVMWebAssemblyDisassembler.a
lib/libLLVMWebAssemblyInfo.a lib/libLLVMX86CodeGen.a
lib/libLLVMX86AsmParser.a lib/libLLVMX86AsmPrinter.a
lib/libLLVMX86Desc.a lib/libLLVMX86Disassembler.a lib/libLLVMX86Info.a
lib/libLLVMX86Utils.a lib/libLLVMXCoreCodeGen.a
lib/libLLVMXCoreAsmPrinter.a lib/libLLVMXCoreDesc.a
lib/libLLVMXCoreDisassembler.a lib/libLLVMXCoreInfo.a
lib/libLLVMAggressiveInstCombine.a lib/libLLVMAnalysis.a
lib/libLLVMBitWriter.a lib/libLLVMCodeGen.a lib/libLLVMCore.a
lib/libLLVMCoroutines.a lib/libLLVMipo.a lib/libLLVMIRReader.a
lib/libLLVMInstCombine.a lib/libLLVMInstrumentation.a lib/libLLVMMC.a
lib/libLLVMObjCARCOpts.a lib/libLLVMScalarOpts.a lib/libLLVMSupport.a
lib/libLLVMTarget.a lib/libLLVMTransformUtils.a lib/libLLVMVectorize.a
lib/libLLVMPasses.a -lpthread lib/libLLVMAArch64Desc.a
lib/libLLVMAArch64AsmPrinter.a lib/libLLVMAArch64Info.a
lib/libLLVMAArch64Utils.a lib/libLLVMMIRParser.a
lib/libLLVMAMDGPUDesc.a lib/libLLVMAMDGPUAsmPrinter.a
lib/libLLVMAMDGPUInfo.a lib/libLLVMAMDGPUUtils.a lib/libLLVMARMDesc.a
lib/libLLVMARMAsmPrinter.a lib/libLLVMARMInfo.a lib/libLLVMARMUtils.a
lib/libLLVMBPFAsmPrinter.a lib/libLLVMHexagonDesc.a
lib/libLLVMHexagonInfo.a lib/libLLVMLanaiDesc.a
lib/libLLVMLanaiAsmPrinter.a lib/libLLVMLanaiInfo.a
lib/libLLVMMipsAsmPrinter.a lib/libLLVMMSP430AsmPrinter.a
lib/libLLVMNVPTXAsmPrinter.a lib/libLLVMPowerPCAsmPrinter.a
lib/libLLVMSparcAsmPrinter.a lib/libLLVMSystemZDesc.a
lib/libLLVMSystemZAsmPrinter.a lib/libLLVMSystemZInfo.a
lib/libLLVMWebAssemblyAsmPrinter.a lib/libLLVMGlobalISel.a
lib/libLLVMX86AsmPrinter.a lib/libLLVMX86Utils.a
lib/libLLVMXCoreAsmPrinter.a lib/libLLVMAsmPrinter.a
lib/libLLVMDebugInfoDWARF.a lib/libLLVMSelectionDAG.a
lib/libLLVMMCDisassembler.a lib/libLLVMCodeGen.a lib/libLLVMipo.a
lib/libLLVMBitWriter.a lib/libLLVMIRReader.a lib/libLLVMAsmParser.a
lib/libLLVMLinker.a lib/libLLVMInstrumentation.a
lib/libLLVMScalarOpts.a lib/libLLVMAggressiveInstCombine.a
lib/libLLVMInstCombine.a lib/libLLVMTarget.a lib/libLLVMVectorize.a
lib/libLLVMTransformUtils.a lib/libLLVMAnalysis.a
lib/libLLVMProfileData.a lib/libLLVMObject.a lib/libLLVMMCParser.a
lib/libLLVMMC.a lib/libLLVMDebugInfoCodeView.a
lib/libLLVMDebugInfoMSF.a lib/libLLVMBitReader.a lib/libLLVMCore.a
lib/libLLVMBinaryFormat.a lib/libLLVMRemarks.a lib/libLLVMSupport.a
-lz -lrt -ldl -ltinfo -lpthread -lm /usr/lib/libz3.so
lib/libLLVMDemangle.a && :

Here is the --version of clang I built:

$ /home/wink/prgs/llvm/llvm-project/build-llvm-clang-compiler-rt-master-0460a3629b2-use-ld-bfd/./bin/clang
--version
clang version 9.0.0 (git@github.com:winksaville/llvm-project
0460a3629b2564d9b34702ba05ab3f461533eca9)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/wink/prgs/llvm/llvm-project/build-llvm-clang-compiler-rt-master-0460a3629b2-use-ld-bfd/./bin

And then I check-tsan and get 5 errors:

$ ninja -j11 -v check-tsan
...
Failing Tests (5):
    ThreadSanitizer-x86_64 :: Linux/double_race.cc
    ThreadSanitizer-x86_64 :: inlined_memcpy_race.cc
    ThreadSanitizer-x86_64 :: inlined_memcpy_race2.cc
    ThreadSanitizer-x86_64 :: memcmp_race.cc
    ThreadSanitizer-x86_64 :: memcpy_race.cc

  Expected Passes : 309
  Expected Failures : 1
  Unsupported Tests : 80
  Unexpected Failures: 5
FAILED: projects/compiler-rt/test/tsan/CMakeFiles/check-tsan
cd /home/wink/prgs/llvm/llvm-project/build-llvm-clang-compiler-rt-master-0460a3629b2-use-ld-bfd/projects/compiler-rt/test/tsan
&& /usr/bin/python2.7
/home/wink/prgs/llvm/llvm-project/build-llvm-clang-compiler-rt-master-0460a3629b2-use-ld-bfd/./bin/llvm-lit
-sv /home/wink/prgs/llvm/llvm-project/build-llvm-clang-compiler-rt-master-0460a3629b2-use-ld-bfd/projects/compiler-rt/test/tsan/X86_64Config
/home/wink/prgs/llvm/llvm-project/build-llvm-clang-compiler-rt-master-0460a3629b2-use-ld-bfd/projects/compiler-rt/test/tsan/Unit
ninja: build stopped: subcommand failed.

I looked more closely at the memcpy_race.cc failure:

******************** TEST 'ThreadSanitizer-x86_64 :: memcpy_race.cc'
FAILED ********************
Script:

I've opened a bug, https://bugs.llvm.org/show_bug.cgi?id=41805 ,
Please add comments there.