Skip to content

Commit 976345a

Browse files
committed
Workaround for Abseil & ASan interaction
1 parent e9694af commit 976345a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/runtime/RuntimeData.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#ifdef TYPEART_PHMAP
2222
#error TypeART-RT: Set ABSL and PHMAP, mutually exclusive.
2323
#endif
24+
2425
#pragma GCC diagnostic push
2526
#pragma GCC diagnostic ignored "-Wpedantic"
2627
#pragma GCC diagnostic ignored "-Wshadow"
@@ -49,6 +50,12 @@
4950
#include "safe_ptr.h"
5051
#endif
5152

53+
#if defined(__has_feature)
54+
#if __has_feature(address_sanitizer)
55+
#define __SANITIZE_ADDRESS__
56+
#endif
57+
#endif
58+
5259
#include <cstddef> // size_t
5360
#include <cstdint>
5461
#include <vector>
@@ -88,7 +95,11 @@ struct RuntimeT {
8895
#ifdef TYPEART_ABSEIL
8996
using PointerMapBaseT = absl::btree_map<MemAddr, PointerInfo>;
9097
template <class K, class V>
91-
using HashmapT = absl::flat_hash_map<K, V>;
98+
#ifdef __SANITIZE_ADDRESS__
99+
using HashmapT = std::unordered_map<K, V>;
100+
#else
101+
using HashmapT = absl::flat_hash_map<K, V>;
102+
#endif
92103
static constexpr char MapName[] = "absl::btree_map";
93104
#endif
94105
#if !defined(TYPEART_PHMAP) && !defined(TYPEART_ABSEIL)

test/lit.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ if config.asan:
4343
config.available_features.add('asan')
4444
if config.ubsan:
4545
config.available_features.add('ubsan')
46+
# config.environment['UBSAN_OPTIONS'] = 'silence_unsigned_overflow=1'
4647
if config.tsan:
4748
config.available_features.add('tsan')
4849
if config.tsan or config.asan or config.ubsan:

0 commit comments

Comments
 (0)