CMake: Remove unsigned-integer-overflow check from UBSan compiler flags because it is too noisy.

This commit is contained in:
Bhargava Shastry 2021-09-01 12:42:36 +02:00
parent 29cc7aa951
commit 7b05d3bc70

View File

@ -200,6 +200,10 @@ if (SANITIZE)
elseif (sanitizer STREQUAL "undefined") elseif (sanitizer STREQUAL "undefined")
# The following flags not used by fuzzer but used by us may create problems, so consider # The following flags not used by fuzzer but used by us may create problems, so consider
# disabling them: alignment, pointer-overflow. # disabling them: alignment, pointer-overflow.
# The following flag is not used by us to reduce terminal noise
# i.e., warnings printed on stderr: unsigned-integer-overflow
# Note: The C++ standard does not officially consider unsigned integer overflows
# to be undefined behavior since they are implementation independent.
# Flags are alphabetically sorted and are for clang v10.0 # Flags are alphabetically sorted and are for clang v10.0
list(APPEND undefinedSanitizerChecks list(APPEND undefinedSanitizerChecks
alignment alignment
@ -217,18 +221,12 @@ if (SANITIZE)
returns-nonnull-attribute returns-nonnull-attribute
shift shift
signed-integer-overflow signed-integer-overflow
unsigned-integer-overflow
unreachable unreachable
vla-bound vla-bound
vptr vptr
) )
list(JOIN undefinedSanitizerChecks "," sanitizerChecks) list(JOIN undefinedSanitizerChecks "," sanitizerChecks)
list(REMOVE_ITEM undefinedSanitizerChecks unsigned-integer-overflow) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${sanitizerChecks} -fno-sanitize-recover=${sanitizerChecks}")
# The fuzzer excludes reports of unsigned-integer-overflow. Hence, we remove it
# from the -fno-sanitize-recover checks. Consider reducing this list if we do not
# want to be notified about other failed checks.
list(JOIN undefinedSanitizerChecks "," dontRecoverFromChecks)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${sanitizerChecks} -fno-sanitize-recover=${dontRecoverFromChecks}")
endif() endif()
endif() endif()