[PATCH] D46650: [lsan] Try to fix test failure due to compiler optimization

Peter Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 10 12:06:14 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL332020: [lsan] Try to fix test failure due to compiler optimization (authored by Lekensteyn, committed by ).
Herald added a subscriber: delcypher.

Changed prior to commit:
  https://reviews.llvm.org/D46650?vs=146167&id=146180#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D46650

Files:
  compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/sanitizer_set_death_callback_test.cc


Index: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/sanitizer_set_death_callback_test.cc
===================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/sanitizer_set_death_callback_test.cc
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/sanitizer_set_death_callback_test.cc
@@ -2,12 +2,6 @@
 
 // REQUIRES: stable-runtime
 
-// For standalone LSan on x86 we have a problem: compiler spills the address
-// of allocated at line 42 memory thus memory block allocated in Leak() function
-// ends up to be classified as reachable despite the fact we zero out 'sink' at
-// the last line of main function. The problem doesn't reproduce with ASan because
-// quarantine prohibits memory block reuse for different allocations.
-// XFAIL: lsan-x86
 // XFAIL: ubsan
 
 #include <sanitizer/common_interface_defs.h>
@@ -31,7 +25,10 @@
 
 __attribute__((noinline))
 void Leak() {
-  sink = new char[100];  // trigger lsan report.
+  // Trigger lsan report. Two attempts in case the address of the first
+  // allocation remained on the stack.
+  sink = new char[100];
+  sink = new char[100];
 }
 
 int main(int argc, char **argv) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46650.146180.patch
Type: text/x-patch
Size: 1209 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180510/339c5ef7/attachment.bin>


More information about the llvm-commits mailing list