Skip to content

Commit bdbaf37

Browse files
derekmaurocopybara-github
authored andcommitted
UBSAN: Use -fno-sanitize-recover
-fno-sanitize-recover will cause tests that encounter undefined behavior to abort and fail, instead of just logging an error message. PiperOrigin-RevId: 733779444 Change-Id: I3f88aef8f91d64572e9d46ad8f6cc40562f25a30
1 parent e593483 commit bdbaf37

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ci/linux_clang-latest_libcxx_asan_bazel.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ if [[ ${KOKORO_GFILE_DIR:-} ]] && [[ -d "${KOKORO_GFILE_DIR}/distdir" ]]; then
5959
BAZEL_EXTRA_ARGS="--distdir=/distdir ${BAZEL_EXTRA_ARGS:-}"
6060
fi
6161

62+
# https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#available-checks
63+
readonly UBSAN_CHECKS="float-divide-by-zero,nullability,undefined"
64+
6265
for std in ${STD}; do
6366
for compilation_mode in ${COMPILATION_MODE}; do
6467
for exceptions_mode in ${EXCEPTIONS_MODE}; do
@@ -79,9 +82,8 @@ for std in ${STD}; do
7982
--copt="${exceptions_mode}" \
8083
--copt="-DGTEST_REMOVE_LEGACY_TEST_CASEAPI_=1" \
8184
--copt="-fsanitize=address" \
82-
--copt="-fsanitize=float-divide-by-zero" \
83-
--copt="-fsanitize=nullability" \
84-
--copt="-fsanitize=undefined" \
85+
--copt="-fsanitize=${UBSAN_CHECKS}" \
86+
--copt="-fno-sanitize-recover=${UBSAN_CHECKS}" \
8587
--copt="-fno-sanitize-blacklist" \
8688
--copt=-Werror \
8789
--enable_bzlmod=true \

0 commit comments

Comments
 (0)