summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/asan/TestCases/use-after-scope-loop.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2019-08-05 16:48:12 +0000
committerNico Weber <nicolasweber@gmx.de>2019-08-05 16:48:12 +0000
commit673dc3d4a0b0fbb3b9b34ae2ecbfa522627fe582 (patch)
tree93e9f9c3508af096ba717ef85186950135b4c225 /compiler-rt/test/asan/TestCases/use-after-scope-loop.cpp
parenta96cfee98a22e262367868f343b599c2312149b7 (diff)
downloadbcm5719-llvm-673dc3d4a0b0fbb3b9b34ae2ecbfa522627fe582.tar.gz
bcm5719-llvm-673dc3d4a0b0fbb3b9b34ae2ecbfa522627fe582.zip
compiler-rt: Rename cc files below test/asan to cpp
See r367803 and similar other changes. llvm-svn: 367887
Diffstat (limited to 'compiler-rt/test/asan/TestCases/use-after-scope-loop.cpp')
-rw-r--r--compiler-rt/test/asan/TestCases/use-after-scope-loop.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler-rt/test/asan/TestCases/use-after-scope-loop.cpp b/compiler-rt/test/asan/TestCases/use-after-scope-loop.cpp
new file mode 100644
index 00000000000..dcd6435aefc
--- /dev/null
+++ b/compiler-rt/test/asan/TestCases/use-after-scope-loop.cpp
@@ -0,0 +1,14 @@
+// RUN: %clangxx_asan -O1 -fsanitize-address-use-after-scope %s -o %t && \
+// RUN: not %run %t 2>&1 | FileCheck %s
+
+int *p[3];
+
+int main() {
+ for (int i = 0; i < 3; i++) {
+ int x;
+ p[i] = &x;
+ }
+ return **p; // BOOM
+ // CHECK: ERROR: AddressSanitizer: stack-use-after-scope
+ // CHECK: #0 0x{{.*}} in main {{.*}}.cpp:[[@LINE-2]]
+}
OpenPOWER on IntegriCloud