diff options
author | Kostya Serebryany <kcc@google.com> | 2013-08-28 08:59:23 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2013-08-28 08:59:23 +0000 |
commit | 6102afb6651a43f6fa3c66810e321e464aff1172 (patch) | |
tree | 93b67e9210c613ad2030663156155f6e12598445 /lib/asan/lit_tests | |
parent | 544bdfb538d082109194952ce66907b917eb8d51 (diff) | |
download | compiler-rt-6102afb6651a43f6fa3c66810e321e464aff1172.tar.gz compiler-rt-6102afb6651a43f6fa3c66810e321e464aff1172.tar.bz2 compiler-rt-6102afb6651a43f6fa3c66810e321e464aff1172.tar.xz |
[asan]: fix a CHECK failure in use-after-return mode; enable and fix stack-use-after-return.cc; add a test for UAR mode in asan_noinst_test
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@189457 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/lit_tests')
-rw-r--r-- | lib/asan/lit_tests/TestCases/stack-use-after-return.cc | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/asan/lit_tests/TestCases/stack-use-after-return.cc b/lib/asan/lit_tests/TestCases/stack-use-after-return.cc index 8064ffd8..750f187e 100644 --- a/lib/asan/lit_tests/TestCases/stack-use-after-return.cc +++ b/lib/asan/lit_tests/TestCases/stack-use-after-return.cc @@ -1,15 +1,21 @@ -// XFAIL: * // RUN: %clangxx_asan -fsanitize=use-after-return -O0 %s -o %t && \ -// RUN: %t 2>&1 | FileCheck %s +// RUN: not %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -fsanitize=use-after-return -O1 %s -o %t && \ -// RUN: %t 2>&1 | FileCheck %s +// RUN: not %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -fsanitize=use-after-return -O2 %s -o %t && \ -// RUN: %t 2>&1 | FileCheck %s +// RUN: not %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -fsanitize=use-after-return -O3 %s -o %t && \ -// RUN: %t 2>&1 | FileCheck %s +// RUN: not %t 2>&1 | FileCheck %s +// Regression test for a CHECK failure with small stack size and large frame. +// RUN: %clangxx_asan -fsanitize=use-after-return -O3 %s -o %t -DkSize=10000 && \ +// RUN: (ulimit -s 65; not %t) 2>&1 | FileCheck %s #include <stdio.h> +#ifndef kSize +# define kSize 1 +#endif + __attribute__((noinline)) char *Ident(char *x) { fprintf(stderr, "1: %p\n", x); @@ -18,8 +24,8 @@ char *Ident(char *x) { __attribute__((noinline)) char *Func1() { - char local; - return Ident(&local); + char local[kSize]; + return Ident(local); } __attribute__((noinline)) @@ -28,7 +34,7 @@ void Func2(char *x) { *x = 1; // CHECK: WRITE of size 1 {{.*}} thread T0 // CHECK: #0{{.*}}Func2{{.*}}stack-use-after-return.cc:[[@LINE-2]] - // CHECK: is located {{.*}} in frame <{{.*}}Func1{{.*}}> of T0's stack + // CHECK: is located in stack of thread T0 at offset } int main(int argc, char **argv) { |