Skip to content

Commit

Permalink
UBSAN: Use -fno-sanitize-recover
Browse files Browse the repository at this point in the history
-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
  • Loading branch information
derekmauro authored and copybara-github committed Mar 5, 2025
1 parent e593483 commit bdbaf37
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ci/linux_clang-latest_libcxx_asan_bazel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ if [[ ${KOKORO_GFILE_DIR:-} ]] && [[ -d "${KOKORO_GFILE_DIR}/distdir" ]]; then
BAZEL_EXTRA_ARGS="--distdir=/distdir ${BAZEL_EXTRA_ARGS:-}"
fi

# https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#available-checks
readonly UBSAN_CHECKS="float-divide-by-zero,nullability,undefined"

for std in ${STD}; do
for compilation_mode in ${COMPILATION_MODE}; do
for exceptions_mode in ${EXCEPTIONS_MODE}; do
Expand All @@ -79,9 +82,8 @@ for std in ${STD}; do
--copt="${exceptions_mode}" \
--copt="-DGTEST_REMOVE_LEGACY_TEST_CASEAPI_=1" \
--copt="-fsanitize=address" \
--copt="-fsanitize=float-divide-by-zero" \
--copt="-fsanitize=nullability" \
--copt="-fsanitize=undefined" \
--copt="-fsanitize=${UBSAN_CHECKS}" \
--copt="-fno-sanitize-recover=${UBSAN_CHECKS}" \
--copt="-fno-sanitize-blacklist" \
--copt=-Werror \
--enable_bzlmod=true \
Expand Down

0 comments on commit bdbaf37

Please sign in to comment.