[PATCH] D103298: [gn] Make ubsan errors fatal, as in cmake

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 27 20:02:48 PDT 2021


rnk created this revision.
rnk added reviewers: aeubanks, thakis.
rnk requested review of this revision.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103298

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


Index: llvm/utils/gn/build/BUILD.gn
===================================================================
--- llvm/utils/gn/build/BUILD.gn
+++ llvm/utils/gn/build/BUILD.gn
@@ -298,7 +298,7 @@
   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" ]
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103298.348435.patch
Type: text/x-patch
Size: 471 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210528/a29513ba/attachment.bin>


More information about the llvm-commits mailing list