From: Reid Kleckner Date: Fri, 28 May 2021 03:00:20 +0000 (-0700) Subject: [gn] Make ubsan errors fatal, as in cmake X-Git-Tag: llvmorg-14-init~5339 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4c6e2774d8273ecf8b23f376066249fee5e6f9f6;p=platform%2Fupstream%2Fllvm.git [gn] Make ubsan errors fatal, as in cmake Apparently ubsan errors are non-fatal by default. If you introduce UB into LLVM and run the tests, if errors are not fatal, the test will still produce the expected output and the tests will pass. In order to make ubsan errors show up as test failures, they have to be made fatal. Pass the -fno-sanitize-recover=all flag to make it so. Differential Revision: https://reviews.llvm.org/D103298 --- diff --git a/llvm/utils/gn/build/BUILD.gn b/llvm/utils/gn/build/BUILD.gn index 757d0b6..a7531fa 100644 --- a/llvm/utils/gn/build/BUILD.gn +++ b/llvm/utils/gn/build/BUILD.gn @@ -298,7 +298,7 @@ config("compiler_defaults") { if (use_ubsan) { assert(is_clang && current_os == "linux", "ubsan only supported on Linux/Clang") - cflags += [ "-fsanitize=undefined" ] + cflags += [ "-fsanitize=undefined", "-fno-sanitize-recover=all" ] ldflags += [ "-fsanitize=undefined" ] }