[llvm-commits] [compiler-rt] r160624 - in /compiler-rt/trunk/lib/asan: asan_allocator.cc tests/asan_noinst_test.cc tests/asan_test.cc
Alexey Samsonov
samsonov at google.com
Mon Jul 23 02:11:59 PDT 2012
Author: samsonov
Date: Mon Jul 23 04:11:58 2012
New Revision: 160624
URL: http://llvm.org/viewvc/llvm-project?rev=160624&view=rev
Log:
[ASan] minor fixes to silence cmake build warnings
Modified:
compiler-rt/trunk/lib/asan/asan_allocator.cc
compiler-rt/trunk/lib/asan/tests/asan_noinst_test.cc
compiler-rt/trunk/lib/asan/tests/asan_test.cc
Modified: compiler-rt/trunk/lib/asan/asan_allocator.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator.cc?rev=160624&r1=160623&r2=160624&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_allocator.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_allocator.cc Mon Jul 23 04:11:58 2012
@@ -42,7 +42,7 @@
namespace __asan {
-#define REDZONE (flags()->redzone)
+#define REDZONE ((uptr)(flags()->redzone))
static const uptr kMinAllocSize = REDZONE * 2;
static const u64 kMaxAvailableRam = 128ULL << 30; // 128G
static const uptr kMaxThreadLocalQuarantine = 1 << 20; // 1M
@@ -344,7 +344,7 @@
AsanChunkFifoList *q = &x->quarantine_;
if (q->size() > 0) {
quarantine_.PushList(q);
- while (quarantine_.size() > flags()->quarantine_size) {
+ while (quarantine_.size() > (uptr)flags()->quarantine_size) {
QuarantinePop();
}
}
@@ -704,7 +704,7 @@
PoisonHeapPartialRightRedzone(addr + rounded_size - REDZONE,
size & (REDZONE - 1));
}
- if (size <= flags()->max_malloc_fill_size) {
+ if (size <= (uptr)(flags()->max_malloc_fill_size)) {
REAL(memset)((void*)addr, 0, rounded_size);
}
return (u8*)addr;
Modified: compiler-rt/trunk/lib/asan/tests/asan_noinst_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_noinst_test.cc?rev=160624&r1=160623&r2=160624&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_noinst_test.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_noinst_test.cc Mon Jul 23 04:11:58 2012
@@ -597,8 +597,10 @@
static void MakeShadowValid(bool *shadow, int length, int granularity) {
bool can_be_poisoned = true;
for (int i = length - 1; i >= 0; i--) {
- can_be_poisoned &= shadow[i];
- shadow[i] &= can_be_poisoned;
+ if (!shadow[i])
+ can_be_poisoned = false;
+ if (!can_be_poisoned)
+ shadow[i] = false;
if (i % (1 << granularity) == 0) {
can_be_poisoned = true;
}
@@ -619,9 +621,9 @@
__asan_poison_memory_region(arr + l2, s2);
memset(expected, false, kSize);
memset(expected + l1, true, s1);
- MakeShadowValid(expected, 24, /*granularity*/ 3);
+ MakeShadowValid(expected, kSize, /*granularity*/ 3);
memset(expected + l2, true, s2);
- MakeShadowValid(expected, 24, /*granularity*/ 3);
+ MakeShadowValid(expected, kSize, /*granularity*/ 3);
for (size_t i = 0; i < kSize; i++) {
ASSERT_EQ(expected[i], __asan_address_is_poisoned(arr + i));
}
@@ -631,9 +633,9 @@
__asan_unpoison_memory_region(arr + l2, s2);
memset(expected, true, kSize);
memset(expected + l1, false, s1);
- MakeShadowValid(expected, 24, /*granularity*/ 3);
+ MakeShadowValid(expected, kSize, /*granularity*/ 3);
memset(expected + l2, false, s2);
- MakeShadowValid(expected, 24, /*granularity*/ 3);
+ MakeShadowValid(expected, kSize, /*granularity*/ 3);
for (size_t i = 0; i < kSize; i++) {
ASSERT_EQ(expected[i], __asan_address_is_poisoned(arr + i));
}
@@ -670,7 +672,8 @@
for (int i = 0; i < len; i++) {
if (dup[i] == '1') dup[i] = 'Z';
}
- write(2, dup, len);
+ int written = write(2, dup, len);
+ ASSERT_EQ(len, written);
free(dup);
}
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=160624&r1=160623&r2=160624&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_test.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_test.cc Mon Jul 23 04:11:58 2012
@@ -34,12 +34,6 @@
#include <CoreFoundation/CFString.h>
#endif // __APPLE__
-#ifdef __APPLE__
-static bool APPLE = true;
-#else
-static bool APPLE = false;
-#endif
-
#if ASAN_HAS_EXCEPTIONS
# define ASAN_THROW(x) throw (x)
#else
More information about the llvm-commits
mailing list