summaryrefslogtreecommitdiff
path: root/test/asan/TestCases/use-after-scope-loop-bug.cc
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2016-04-22 00:10:23 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2016-04-22 00:10:23 +0000
commitd2f951ce190c39b711e2563d84b9510b71eecc89 (patch)
tree3da7cef920eeec953673cb90e37cdee4282374fe /test/asan/TestCases/use-after-scope-loop-bug.cc
parent33f89a1f101182f2f316a3e142caa93d244b4ee7 (diff)
Enable stack-use-after-scope tests.
Fix and enable working stack-use-after-scope tests. Add more failing tests for the feature, for fix later. PR27453. Patch by Vitaly Buka. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267084 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/asan/TestCases/use-after-scope-loop-bug.cc')
-rw-r--r--test/asan/TestCases/use-after-scope-loop-bug.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/asan/TestCases/use-after-scope-loop-bug.cc b/test/asan/TestCases/use-after-scope-loop-bug.cc
new file mode 100644
index 000000000..6d8e88870
--- /dev/null
+++ b/test/asan/TestCases/use-after-scope-loop-bug.cc
@@ -0,0 +1,16 @@
+// RUN: %clangxx_asan -O1 -mllvm -asan-use-after-scope=1 %s -o %t && \
+// RUN: not %run %t 2>&1 | FileCheck %s
+//
+// FIXME: @llvm.lifetime.* are not emitted for x.
+// XFAIL: *
+
+int *p;
+
+int main() {
+ // Variable goes in and out of scope.
+ for (int i = 0; i < 3; ++i) {
+ int x[3] = {i, i, i};
+ p = x + i;
+ }
+ return *p; // BOOM
+}