[llvm-commits] [compiler-rt] r171223 - /compiler-rt/trunk/lib/asan/tests/asan_test.cc

Kostya Serebryany kcc at google.com
Sat Dec 29 06:42:48 PST 2012


Author: kcc
Date: Sat Dec 29 08:42:48 2012
New Revision: 171223

URL: http://llvm.org/viewvc/llvm-project?rev=171223&view=rev
Log:
[asan] make LargeOOBInMemset test resistant to clever compiler optimizations

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=171223&r1=171222&r2=171223&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_test.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_test.cc Sat Dec 29 08:42:48 2012
@@ -925,7 +925,7 @@
 // Try to allocate two arrays of 'size' bytes that are near each other.
 // Strictly speaking we are not guaranteed to find such two pointers,
 // but given the structure of asan's allocator we will.
-static bool AllocateTwoAjacentArrays(char **x1, char **x2, size_t size) {
+static bool AllocateTwoAdjacentArrays(char **x1, char **x2, size_t size) {
   vector<char *> v;
   bool res = false;
   for (size_t i = 0; i < 1000U && !res; i++) {
@@ -954,11 +954,12 @@
 TEST(AddressSanitizer, LargeOOBInMemset) {
   for (size_t size = 200; size < 100000; size += size / 2) {
     char *x1, *x2;
-    if (!AllocateTwoAjacentArrays(&x1, &x2, size))
+    if (!Ident(AllocateTwoAdjacentArrays)(&x1, &x2, size))
       continue;
     // fprintf(stderr, "  large oob memset: %p %p %zd\n", x1, x2, size);
     // Do a memset on x1 with huge out-of-bound access that will end up in x2.
-    EXPECT_DEATH(memset(x1, 0, size * 2), "is located 0 bytes to the right");
+    EXPECT_DEATH(Ident(memset)(x1, 0, size * 2),
+                 "is located 0 bytes to the right");
     delete [] x1;
     delete [] x2;
     return;





More information about the llvm-commits mailing list