[lsan] Fix flaky test in swapcontext.cpp (#175635) LSan, by design, can have false negatives, making it unreliable to check that the leak was found in the stack-allocated case: ``` ==123685==Scanning STACK range 0x7ffe6e554ca0-0x7ffe6e557000. ==123685==0x7ffe6e554de0: found 0x51e0000009f0 pointing into chunk 0x51e000000000-0x51e000000c00 of size 3072. ==123685==0x7ffe6e554e30: found 0x51e000000c00 pointing into chunk 0x51e000000c00-0x51e000001668 of size 2664. <- this prevented the leak from being found ``` This has led to flakiness on the buildbots e.g., https://lab.llvm.org/buildbot/#/builders/66/builds/24669 ``` # | /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lsan/TestCases/swapcontext.cpp:44:11: error: CHECK: expected string not found in input # | // CHECK: SUMMARY: {{.*}}Sanitizer: 2664 byte(s) leaked in 1 allocation(s) ... Failed Tests (2): LeakSanitizer-HWAddressSanitizer-x86_64 :: TestCases/swapcontext.cpp LeakSanitizer-Standalone-x86_64 :: TestCases/swapcontext.cpp ``` This patch fixes the issue by clearing the buffer, as suggested by Vitaly.
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.