summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan/lit_tests/TestCases/use-after-scope-nobug.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/lib/asan/lit_tests/TestCases/use-after-scope-nobug.cc')
-rw-r--r--compiler-rt/lib/asan/lit_tests/TestCases/use-after-scope-nobug.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/compiler-rt/lib/asan/lit_tests/TestCases/use-after-scope-nobug.cc b/compiler-rt/lib/asan/lit_tests/TestCases/use-after-scope-nobug.cc
new file mode 100644
index 00000000000..56a2756011c
--- /dev/null
+++ b/compiler-rt/lib/asan/lit_tests/TestCases/use-after-scope-nobug.cc
@@ -0,0 +1,16 @@
+// RUN: %clangxx_asan -m64 -O0 -fsanitize=use-after-scope %s -o %t && \
+// RUN: %t 2>&1 | %symbolize | FileCheck %s
+
+#include <stdio.h>
+
+int main() {
+ int *p = 0;
+ // Variable goes in and out of scope.
+ for (int i = 0; i < 3; i++) {
+ int x = 0;
+ p = &x;
+ }
+ printf("PASSED\n");
+ // CHECK: PASSED
+ return 0;
+}
OpenPOWER on IntegriCloud