diff options
| author | Kuba Mracek <mracek@apple.com> | 2017-03-31 03:00:29 +0000 |
|---|---|---|
| committer | Kuba Mracek <mracek@apple.com> | 2017-03-31 03:00:29 +0000 |
| commit | b2e26345106199bf395d9e0abccc1333af06859b (patch) | |
| tree | 9c8e0c125f5b92b8478ccc9d2e57e614f55e5228 | |
| parent | b26f8576120c3825fc15b0e95a98de0e1cb81cfc (diff) | |
| download | bcm5719-llvm-b2e26345106199bf395d9e0abccc1333af06859b.tar.gz bcm5719-llvm-b2e26345106199bf395d9e0abccc1333af06859b.zip | |
[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
llvm-svn: 299175
| -rw-r--r-- | compiler-rt/test/asan/TestCases/use-after-scope.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler-rt/test/asan/TestCases/use-after-scope.cc b/compiler-rt/test/asan/TestCases/use-after-scope.cc index d92dae6572c..4c5998abe20 100644 --- a/compiler-rt/test/asan/TestCases/use-after-scope.cc +++ b/compiler-rt/test/asan/TestCases/use-after-scope.cc @@ -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() { |

