Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ASAN report an error if we tries to downcast a misaligned address. To avoid it, we need to check if an address is valid before casting it. Here is the ASAN error: /home/runner/work/mold/mold/third-party/tbb/src/tbb/../../include/tbb/../oneapi/tbb/concurrent_hash_map.h:446:23: runtime error: downcast of misaligned address 0x000000000003 for type 'tbb::detail::d2::hash_map_iterator<tbb::detail::d2::concurrent_hash_map<std::basic_string_view<char, std::char_traits<char>>, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, tbb::detail::d1::tbb_hash_compare<std::basic_string_view<char, std::char_traits<char>>>, tbb::detail::d1::tbb_allocator<std::pair<const std::basic_string_view<char, std::char_traits<char>>, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>>>, std::pair<const std::basic_string_view<char, std::char_traits<char>>, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, st0x000000000003: note: pointer points here <memory cannot be printed> SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/runner/work/mold/mold/third-party/tbb/src/tbb/../../include/tbb/../oneapi/tbb/concurrent_hash_map.h:446:23 Signed-off-by: Rui Ueyama <ruiu@cs.stanford.edu> Signed-off-by: Rui Ueyama <ruiu@cs.stanford.edu>
- Loading branch information