From 4c6e2774d8273ecf8b23f376066249fee5e6f9f6 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Thu, 27 May 2021 20:00:20 -0700 Subject: [PATCH] [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 --- llvm/utils/gn/build/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" ] } -- 2.7.4