diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:45:36 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:45:36 +0000 |
commit | 6f08730ec5f639f05f2f15354171e4a3c9af9dc1 (patch) | |
tree | 7374e9d4448083010ada98d17976199c7e945d47 /test/asan/TestCases/use-after-scope-loop-bug.cc | |
parent | c003a57e2e4a1ad9be0338806bc1038b6987155f (diff) |
Notes
Diffstat (limited to 'test/asan/TestCases/use-after-scope-loop-bug.cc')
-rw-r--r-- | test/asan/TestCases/use-after-scope-loop-bug.cc | 16 |
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 0000000000000..6ad9bf3260ccd --- /dev/null +++ b/test/asan/TestCases/use-after-scope-loop-bug.cc @@ -0,0 +1,16 @@ +// RUN: %clangxx_asan -O1 -fsanitize-address-use-after-scope %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 +} |