[llvm-commits] [compiler-rt] r149491 - /compiler-rt/trunk/lib/asan/tests/asan_test.cc
Alexander Potapenko
glider at google.com
Wed Feb 1 01:47:40 PST 2012
Author: glider
Date: Wed Feb 1 03:47:40 2012
New Revision: 149491
URL: http://llvm.org/viewvc/llvm-project?rev=149491&view=rev
Log:
Disables testing memcpy() on Mac OS 10.7,
where memcpy() in fact aliases memmove() and thus calling it with
overlapping parameters is not an error.
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=149491&r1=149490&r2=149491&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_test.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_test.cc Wed Feb 1 03:47:40 2012
@@ -30,6 +30,7 @@
#ifndef __APPLE__
#include <malloc.h>
#else
+#include <AvailabilityMacros.h> // For MAC_OS_X_VERSION_*
#include <CoreFoundation/CFString.h>
#endif // __APPLE__
@@ -1305,12 +1306,17 @@
size_t size = Ident(100);
char *str = Ident((char*)malloc(size));
+// Do not check memcpy() on OS X 10.7 and later, where it actually aliases
+// memmove().
+#if !defined(__APPLE__) || !defined(MAC_OS_X_VERSION_10_7) || \
+ (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7)
// Check "memcpy". Use Ident() to avoid inlining.
memset(str, 'z', size);
Ident(memcpy)(str + 1, str + 11, 10);
Ident(memcpy)(str, str, 0);
EXPECT_DEATH(Ident(memcpy)(str, str + 14, 15), OverlapErrorMessage("memcpy"));
EXPECT_DEATH(Ident(memcpy)(str + 14, str, 15), OverlapErrorMessage("memcpy"));
+#endif
// We do not treat memcpy with to==from as a bug.
// See http://llvm.org/bugs/show_bug.cgi?id=11763.
More information about the llvm-commits
mailing list