[llvm-commits] [compiler-rt] r146203 - /compiler-rt/trunk/lib/asan/tests/asan_test.cc
Kostya Serebryany
kcc at google.com
Thu Dec 8 15:30:48 PST 2011
Author: kcc
Date: Thu Dec 8 17:30:48 2011
New Revision: 146203
URL: http://llvm.org/viewvc/llvm-project?rev=146203&view=rev
Log:
[asan] better test for use-after-return mode
Modified:
compiler-rt/trunk/lib/asan/tests/asan_test.cc
Modified: compiler-rt/trunk/lib/asan/tests/asan_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_test.cc?rev=146203&r1=146202&r2=146203&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_test.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_test.cc Thu Dec 8 17:30:48 2011
@@ -577,7 +577,7 @@
}
TEST(AddressSanitizer, ManyThreadsTest) {
- const size_t kNumThreads = __WORDSIZE == 32 ? 150 : 1000;
+ const size_t kNumThreads = __WORDSIZE == 32 ? 30 : 1000;
pthread_t t[kNumThreads];
for (size_t i = 0; i < kNumThreads; i++) {
pthread_create(&t[i], 0, (void* (*)(void *x))ManyThreadsWorker, (void*)i);
@@ -1581,17 +1581,17 @@
return Ident(&a);
}
+#if ASAN_UAR == 1
TEST(AddressSanitizer, LocalReferenceReturnTest) {
int *(*f)() = Ident(ReturnsPointerToALocalObject);
- // Call f several times, only the first time should be reported.
- f();
- f();
- f();
- f();
- if (ASAN_UAR) {
- EXPECT_DEATH(*f() = 1, "is located.*in frame .*ReturnsPointerToALocal");
- }
+ int *p = f();
+ // Call 'f' a few more times, 'p' should still be poisoned.
+ for (int i = 0; i < 32; i++)
+ f();
+ EXPECT_DEATH(*p = 1, "AddressSanitizer stack-use-after-return");
+ EXPECT_DEATH(*p = 1, "is located.*in frame .*ReturnsPointerToALocal");
}
+#endif
template <int kSize>
__attribute__((noinline))
More information about the llvm-commits
mailing list