[llvm] 4c6e277 - [gn] Make ubsan errors fatal, as in cmake

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Fri May 28 08:05:48 PDT 2021


Author: Reid Kleckner
Date: 2021-05-28T08:05:37-07:00
New Revision: 4c6e2774d8273ecf8b23f376066249fee5e6f9f6

URL: https://github.com/llvm/llvm-project/commit/4c6e2774d8273ecf8b23f376066249fee5e6f9f6
DIFF: https://github.com/llvm/llvm-project/commit/4c6e2774d8273ecf8b23f376066249fee5e6f9f6.diff

LOG: [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

Added: 
    

Modified: 
    llvm/utils/gn/build/BUILD.gn

Removed: 
    


################################################################################
diff  --git a/llvm/utils/gn/build/BUILD.gn b/llvm/utils/gn/build/BUILD.gn
index 757d0b6de4d3c..a7531fa2b6635 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" ]
   }
 


        


More information about the llvm-commits mailing list