[PATCH] D31479: [asan] Turn -fsanitize-address-use-after-scope on by default

Kuba (Brecka) Mracek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 29 16:41:17 PDT 2017


kubamracek updated this revision to Diff 93425.
kubamracek added a comment.

I extracted the StackVarDescr change into https://reviews.llvm.org/D31484.  This patch now simply just enables `-fsanitize-address-use-after-scope` by default.


https://reviews.llvm.org/D31479

Files:
  projects/compiler-rt/test/asan/TestCases/use-after-scope.cc
  tools/clang/include/clang/Driver/SanitizerArgs.h
  tools/clang/test/Driver/fsanitize.c


Index: projects/compiler-rt/test/asan/TestCases/use-after-scope.cc
===================================================================
--- projects/compiler-rt/test/asan/TestCases/use-after-scope.cc
+++ projects/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() {
Index: tools/clang/test/Driver/fsanitize.c
===================================================================
--- tools/clang/test/Driver/fsanitize.c
+++ tools/clang/test/Driver/fsanitize.c
@@ -121,7 +121,7 @@
 // CHECK-USE-AFTER-SCOPE-BOTH-OFF-NOT: -cc1{{.*}}address-use-after-scope
 
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-WITHOUT-USE-AFTER-SCOPE
-// CHECK-ASAN-WITHOUT-USE-AFTER-SCOPE-NOT: -cc1{{.*}}address-use-after-scope
+// CHECK-ASAN-WITHOUT-USE-AFTER-SCOPE: -cc1{{.*}}address-use-after-scope
 
 // RUN: %clang -target x86_64-linux-gnu -fsanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-TRACK-ORIGINS
 // CHECK-ONLY-TRACK-ORIGINS: warning: argument unused during compilation: '-fsanitize-memory-track-origins'
Index: tools/clang/include/clang/Driver/SanitizerArgs.h
===================================================================
--- tools/clang/include/clang/Driver/SanitizerArgs.h
+++ tools/clang/include/clang/Driver/SanitizerArgs.h
@@ -34,7 +34,7 @@
   bool CfiCrossDso = false;
   int AsanFieldPadding = 0;
   bool AsanSharedRuntime = false;
-  bool AsanUseAfterScope = false;
+  bool AsanUseAfterScope = true;
   bool LinkCXXRuntimes = false;
   bool NeedPIE = false;
   bool Stats = false;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31479.93425.patch
Type: text/x-patch
Size: 1915 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170329/67b6af6e/attachment.bin>


More information about the llvm-commits mailing list