MSAN does not always detect accessing uninitialized bytes after variant destroy
Open
compiler-rt:msan
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
```c++
std::variant v;
v.emplace();
double& d = std::get(v);
v.emplace();
if (d) ...
```
MSAN does not catch the above program, when the type being destroyed due to the second replace is trivial / does not have its own destructor.
See https://github.com/llvm/llvm-project/pull/101048 for background. The fix suggested by this PR (now closed, since that approach is not the right approach) is to emit a destructor call for the trivial case, and have the MSAN runtime properly poison the destructed bytes.
Contributor guide
Assessment
This issue has not been assessed yet.