| Issue |
208649
|
| Summary |
[compiler-rt][tysan][libc++] False positives with std::function callable storage
|
| Labels |
libc++
|
| Assignees |
|
| Reporter |
onurcan-isler-oss
|
# `std::function`
#### Flags: `-stdlib=libc++ -fsanitize=type -O0` or `-stdlib=libc++ -fsanitize=type -O1`
#### Compiler: x86-64 clang 22.1.0
#### Link: https://godbolt.org/z/PYT6Mob5Y
#### Code:
```.cpp
#include <functional>
std::function<void()> f = [](){};
int main() {
f();
}
```
#### Logs:
```
==1==ERROR: TypeSanitizer: type-aliasing-violation on address 0x648731af5f30 (pc 0x648731199f57 bp 0x7ffcbb8ccd10 sp 0x7ffcbb8ccca0 tid 1)
WRITE of size 8 at 0x648731af5f30 with type vtable pointer accesses an existing object of type std::__1::function<void ()>
#0 0x648731199f56 (/app/output.s+0x37f56)
==1==ERROR: TypeSanitizer: type-aliasing-violation on address 0x648731af5f30 (pc 0x648731199360 bp 0x7ffcbb8ccd40 sp 0x7ffcbb8cccd0 tid 1)
WRITE of size 8 at 0x648731af5f30 with type vtable pointer accesses an existing object of type std::__1::function<void ()>
#0 0x64873119935f (/app/output.s+0x3735f)
...
```
#### Explanation:
libc++ `std::function` is likely doing placement-new vtable.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs