summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/asan/TestCases/use-after-scope-chars.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/test/asan/TestCases/use-after-scope-chars.cc')
-rw-r--r--compiler-rt/test/asan/TestCases/use-after-scope-chars.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler-rt/test/asan/TestCases/use-after-scope-chars.cc b/compiler-rt/test/asan/TestCases/use-after-scope-chars.cc
new file mode 100644
index 00000000000..cc983a7cbe3
--- /dev/null
+++ b/compiler-rt/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
+}
OpenPOWER on IntegriCloud