[llvm-commits] [compiler-rt] r170843 - in /compiler-rt/trunk/lib/asan/tests: asan_mac_test.mm asan_test.cc
Richard Relph
Richard.Relph at amd.com
Thu Dec 20 21:17:13 PST 2012
Author: rrelph
Date: Thu Dec 20 23:17:13 2012
New Revision: 170843
URL: http://llvm.org/viewvc/llvm-project?rev=170843&view=rev
Log:
Clean up some warnings that become errors. Seen in Xcode.
Modified:
compiler-rt/trunk/lib/asan/tests/asan_mac_test.mm
compiler-rt/trunk/lib/asan/tests/asan_test.cc
Modified: compiler-rt/trunk/lib/asan/tests/asan_mac_test.mm
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_mac_test.mm?rev=170843&r1=170842&r2=170843&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_mac_test.mm (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_mac_test.mm Thu Dec 20 23:17:13 2012
@@ -57,7 +57,7 @@
@implementation LoadSomething
+(void) load {
- for (int i = 0; i < strlen(kStartupStr); i++) {
+ for (size_t i = 0; i < strlen(kStartupStr); i++) {
access_memory(&kStartupStr[i]); // make sure no optimizations occur.
}
// Don't print anything here not to interfere with the death tests.
@@ -66,13 +66,13 @@
@end
void worker_do_alloc(int size) {
- char * volatile mem = malloc(size);
+ char * volatile mem = (char * volatile)malloc(size);
mem[0] = 0; // Ok
free(mem);
}
void worker_do_crash(int size) {
- char * volatile mem = malloc(size);
+ char * volatile mem = (char * volatile)malloc(size);
access_memory(&mem[size]); // BOOM
free(mem);
}
@@ -167,7 +167,7 @@
dispatch_time(DISPATCH_TIME_NOW, 1LL * NSEC_PER_SEC);
dispatch_source_set_timer(timer, milestone, DISPATCH_TIME_FOREVER, 0);
- char * volatile mem = malloc(10);
+ char * volatile mem = (char * volatile)malloc(10);
dispatch_source_set_event_handler(timer, ^{
access_memory(&mem[10]);
});
@@ -184,7 +184,7 @@
dispatch_time(DISPATCH_TIME_NOW, 1LL * NSEC_PER_SEC);
dispatch_source_set_timer(timer, milestone, DISPATCH_TIME_FOREVER, 0);
- char * volatile mem = malloc(10);
+ char * volatile mem = (char * volatile)malloc(10);
// Both dispatch_source_set_cancel_handler() and
// dispatch_source_set_event_handler() use dispatch_barrier_async_f().
// It's tricky to test dispatch_source_set_cancel_handler() separately,
@@ -202,7 +202,7 @@
void TestGCDGroupAsync() {
dispatch_queue_t queue = dispatch_get_global_queue(0, 0);
dispatch_group_t group = dispatch_group_create();
- char * volatile mem = malloc(10);
+ char * volatile mem = (char * volatile)malloc(10);
dispatch_group_async(group, queue, ^{
access_memory(&mem[10]);
});
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=170843&r1=170842&r2=170843&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_test.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_test.cc Thu Dec 20 23:17:13 2012
@@ -2293,7 +2293,7 @@
TEST(AddressSanitizerMac, Mstats) {
malloc_statistics_t stats1, stats2;
malloc_zone_statistics(/*all zones*/NULL, &stats1);
- const int kMallocSize = 100000;
+ const size_t kMallocSize = 100000;
void *alloc = Ident(malloc(kMallocSize));
malloc_zone_statistics(/*all zones*/NULL, &stats2);
EXPECT_GT(stats2.blocks_in_use, stats1.blocks_in_use);
More information about the llvm-commits
mailing list