Index: cmake/modules/HandleLLVMOptions.cmake =================================================================== --- cmake/modules/HandleLLVMOptions.cmake +++ cmake/modules/HandleLLVMOptions.cmake @@ -555,6 +555,8 @@ append_common_sanitizer_flags() append("-fsanitize=undefined -fno-sanitize=vptr,function -fno-sanitize-recover=all" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + append(" -fsanitize-blacklist=${CMAKE_SOURCE_DIR}/utils/sanitizers/ubsan_blacklist.txt" + CMAKE_C_FLAGS CMAKE_CXX_FLAGS) elseif (LLVM_USE_SANITIZER STREQUAL "Thread") append_common_sanitizer_flags() append("-fsanitize=thread" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) Index: utils/sanitizers/ubsan_blacklist.txt =================================================================== --- /dev/null +++ utils/sanitizers/ubsan_blacklist.txt @@ -0,0 +1,5 @@ +# This blacklist should be applied when LLVM is built +# with -fsanitize=undefined instrumentation. It exists +# because libstdc++ has some undefined behavior issues +# in some of the headers, in particular, stl_tree.h. +src:*bits/stl_tree.h