[PATCH] Tests and interface for LeakSanitizer.

Sergey Matveev earthdok at google.com
Mon May 13 07:24:54 PDT 2013



================
Comment at: lib/lsan/tests/lsan_test.cc:225
@@ +224,3 @@
+  ThreadArgument *arg = reinterpret_cast<ThreadArgument *>(param);
+#if defined(__i386__)
+  register void* p asm("esi");
----------------
Kostya Serebryany wrote:
> the tricks with "register" and asm deserve a comment
ok

================
Comment at: lib/lsan/tests/lsan_test.cc:74
@@ +73,3 @@
+
+volatile void *data_var = (void*) 1;
+
----------------
Kostya Serebryany wrote:
> here and below, will it still work w/o 'volatile'?
StackThreadFunc breaks without volatile. I have been able to remove volatile from the rest of the tests.

================
Comment at: lib/lsan/tests/lsan_test.cc:68
@@ +67,3 @@
+  EXPECT_LEAKED(*p, baseline & ~source);
+  // Check again, in case the first EXPECT_NOT_LEAKED was a false positive.
+  EXPECT_NOT_LEAKED(*p, baseline);
----------------
Kostya Serebryany wrote:
> I am still not getting this. Do you mean "false negative"? 
> Can you explain more?
False negative, yes.

If the first two checks passed, it could have been because the first check was a false negative, but the pointer that caused it got overwritten before the second check started. The third check would catch that, although admittedly it's a long stretch.


http://llvm-reviews.chandlerc.com/D677

BRANCH
  lsan_interface_and_tests

ARCANIST PROJECT
  compiler-rt



More information about the llvm-commits mailing list