From aaa50f06d42f7b8072e0e416a8ab4025921f16ce Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Mon, 14 Jan 2013 10:18:38 +0000 Subject: [PATCH] ASan: Disable alloc/dealloc-mismatch checker on Mac for now (it produces weird false positives on googletest) llvm-svn: 172394 --- compiler-rt/lib/asan/asan_rtl.cc | 4 +++- compiler-rt/lib/asan/tests/asan_test.cc | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/compiler-rt/lib/asan/asan_rtl.cc b/compiler-rt/lib/asan/asan_rtl.cc index b910cf9aa377..70be6dcace5b 100644 --- a/compiler-rt/lib/asan/asan_rtl.cc +++ b/compiler-rt/lib/asan/asan_rtl.cc @@ -144,7 +144,9 @@ void InitializeFlags(Flags *f, const char *env) { f->fast_unwind_on_fatal = true; f->fast_unwind_on_malloc = true; f->poison_heap = true; - f->alloc_dealloc_mismatch = true; + // Turn off alloc/dealloc mismatch checker on Mac for now. + // TODO(glider): Fix known issues and enable this back. + f->alloc_dealloc_mismatch = (ASAN_MAC == 0); f->use_stack_depot = true; // Only affects allocator2. // Override from user-specified string. diff --git a/compiler-rt/lib/asan/tests/asan_test.cc b/compiler-rt/lib/asan/tests/asan_test.cc index 59226b5c79e5..db35d5b5b0f7 100644 --- a/compiler-rt/lib/asan/tests/asan_test.cc +++ b/compiler-rt/lib/asan/tests/asan_test.cc @@ -2060,13 +2060,14 @@ TEST(AddressSanitizer, AttributeNoAddressSafetyTest) { Ident(NoAddressSafety)(); } +// TODO(glider): Enable this test on Mac when alloc/dealloc mismatch is +// fixed there. +#ifndef __APPLE__ static string MismatchStr(const string &str) { return string("AddressSanitizer: alloc-dealloc-mismatch \\(") + str; } -// This test is disabled until we enable alloc_dealloc_mismatch by default. -// The feature is also tested by lit tests. -TEST(AddressSanitizer, DISABLED_AllocDeallocMismatch) { +TEST(AddressSanitizer, AllocDeallocMismatch) { EXPECT_DEATH(free(Ident(new int)), MismatchStr("operator new vs free")); EXPECT_DEATH(free(Ident(new int[2])), @@ -2080,6 +2081,7 @@ TEST(AddressSanitizer, DISABLED_AllocDeallocMismatch) { EXPECT_DEATH(delete [] (Ident((int*)malloc(2 * sizeof(int)))), MismatchStr("malloc vs operator delete \\[\\]")); } +#endif // __APPLE__ // ------------------ demo tests; run each one-by-one ------------- // e.g. --gtest_filter=*DemoOOBLeftHigh --gtest_also_run_disabled_tests