| Issue |
208653
|
| Summary |
[compiler-rt][tysan] False positives with Abseil hash containers
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
onurcan-isler-oss
|
# absl `flat_hash_map`
#### Flags: `-stdlib=libc++ -fsanitize=type -O0`
#### Compiler: x86-64 clang 22.1.0
#### Link: https://godbolt.org/z/YezqaebzT
#### Code:
```.cpp
#include "absl/container/flat_hash_map.h"
#include <string>
int main() {
absl::flat_hash_map<std::string, int> m;
m.reserve(2);
std::string long_string = std::string(100, 'a');
m.emplace(long_string, 0);
int access = m[long_string];
}
```
Static version:
```.cpp
#include <absl/container/flat_hash_map.h>
int main() {
static absl::flat_hash_map<int, int> m;
m[1] = 1;
}
```
#### Logs:
```
==1==ERROR: TypeSanitizer: type-aliasing-violation on address 0x7ffc0df37308 (pc 0x5db1c18dce6c bp 0x7ffc0df371e0 sp 0x7ffc0df37170 tid 1)
WRITE of size 8 at 0x7ffc0df37308 with type long (in absl::lts_20260107::uint128 at offset 8) accesses an existing object of type p1 _ZTSN4absl12lts_202601077uint128E
#0 0x5db1c18dce6b (/app/output.s+0x7de6b)
==1==ERROR: TypeSanitizer: type-aliasing-violation on address 0x7ffc0df36fc8 (pc 0x5db1c18dce6c bp 0x7ffc0df36ea0 sp 0x7ffc0df36e30 tid 1)
WRITE of size 8 at 0x7ffc0df36fc8 with type long (in absl::lts_20260107::uint128 at offset 8) accesses an existing object of type p1 _ZTSN4absl12lts_202601077uint128E
#0 0x5db1c18dce6b (/app/output.s+0x7de6b)
...
```
#### Explanation:
Likely a internal type-punning-ish layout violation.
Global/Static STL containers used to cause false positives in 20.1.0: https://godbolt.org/z/q3TsrK5c4
But fixed in 22.1.0: https://godbolt.org/z/1qE3z6eea
So, global/static absl containers seems still problematic...
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs