[compiler-rt] r299175 - [asan] Turn -fsanitize-address-use-after-scope on by default [compiler-rt part]

Kuba Mracek via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 20:00:29 PDT 2017


Author: kuba.brecka
Date: Thu Mar 30 22:00:29 2017
New Revision: 299175

URL: http://llvm.org/viewvc/llvm-project?rev=299175&view=rev
Log:
[asan] Turn -fsanitize-address-use-after-scope on by default [compiler-rt part]

AddressSanitizer has an optional compile-time flag, -fsanitize-address-use-after-scope, which enables detection of use-after-scope bugs. We'd like to have this feature on by default, because it is already very well tested, it's used in several projects already (LLVM automatically enables it when using -DLLVM_USE_SANITIZER=Address), it's low overhead and there are no known issues or incompatibilities.

This patch enables use-after-scope by default via the Clang driver, where we set true as the default value for AsanUseAfterScope. This also causes the lifetime markers to be generated whenever fsanitize=address is used. This has some nice consequences, e.g. we now have line numbers for all local variables.

Differential Revision: https://reviews.llvm.org/D31479


Modified:
    compiler-rt/trunk/test/asan/TestCases/use-after-scope.cc

Modified: compiler-rt/trunk/test/asan/TestCases/use-after-scope.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/use-after-scope.cc?rev=299175&r1=299174&r2=299175&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/use-after-scope.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/use-after-scope.cc Thu Mar 30 22:00:29 2017
@@ -1,6 +1,10 @@
 // RUN: %clangxx_asan -O1 -fsanitize-address-use-after-scope %s -o %t && \
 // RUN:     not %run %t 2>&1 | FileCheck %s
 
+// -fsanitize-address-use-after-scope is now on by default:
+// RUN: %clangxx_asan -O1 %s -o %t && \
+// RUN:     not %run %t 2>&1 | FileCheck %s
+
 volatile int *p = 0;
 
 int main() {




More information about the llvm-commits mailing list