summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2016-05-02 23:12:04 +0000
committerVitaly Buka <vitalybuka@google.com>2016-05-02 23:12:04 +0000
commit151b497067b300af9d3da4487ce5f92125ff831b (patch)
treec2e561f60b6d5758abdcf82a587541346f680cd0 /test
parent3b2ce46b398f7c0656a1e01d7b1cc603c5f22713 (diff)
Add another failing use-after-scope test
Summary: Use after scope is not detected if array larger then 8 bytes. Subscribers: kubabrecka Differential Revision: http://reviews.llvm.org/D19572 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@268330 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/asan/TestCases/use-after-scope-chars.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/asan/TestCases/use-after-scope-chars.cc b/test/asan/TestCases/use-after-scope-chars.cc
new file mode 100644
index 000000000..cc983a7cb
--- /dev/null
+++ b/test/asan/TestCases/use-after-scope-chars.cc
@@ -0,0 +1,15 @@
+// RUN: %clangxx_asan -O1 -mllvm -asan-use-after-scope=1 %s -o %t && \
+// RUN: not %run %t 2>&1 | FileCheck %s
+// XFAIL: *
+
+// FIXME: This works only for arraysize <= 8.
+
+char *p = 0;
+
+int main() {
+ {
+ char x[1024] = {};
+ p = x;
+ }
+ return *p; // BOOM
+}