[libcxx-commits] [PATCH] D97802: [libc++] Fix incorrect typeinfo comparison on ARM64
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 2 13:23:07 PST 2021
ldionne created this revision.
Herald added subscribers: jkorous, kristof.beyls.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
We are supposed to use deep string comparison when either the LHS or the
RHS can't be guaranteed to be unique, however the current implementation
was using deep comparison only when both the LHS and the RHS couldn't be
guaranteed to be unique.
See https://lists.llvm.org/pipermail/libcxx-dev/2020-December/001060.html.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D97802
Files:
libcxx/include/typeinfo
Index: libcxx/include/typeinfo
===================================================================
--- libcxx/include/typeinfo
+++ libcxx/include/typeinfo
@@ -248,13 +248,13 @@
static bool __eq(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
if (__lhs == __rhs)
return true;
- if (__is_type_name_unique(__lhs, __rhs))
+ if (__is_type_name_unique(__lhs) && __is_type_name_unique(__rhs))
return false;
return __builtin_strcmp(__type_name_to_string(__lhs), __type_name_to_string(__rhs)) == 0;
}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
static bool __lt(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
- if (__is_type_name_unique(__lhs, __rhs))
+ if (__is_type_name_unique(__lhs) && __is_type_name_unique(__rhs))
return __lhs < __rhs;
return __builtin_strcmp(__type_name_to_string(__lhs), __type_name_to_string(__rhs)) < 0;
}
@@ -269,10 +269,6 @@
static bool __is_type_name_unique(__type_name_t __lhs) _NOEXCEPT {
return !(__lhs & __non_unique_rtti_bit::value);
}
- _LIBCPP_INLINE_VISIBILITY
- static bool __is_type_name_unique(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {
- return !((__lhs & __rhs) & __non_unique_rtti_bit::value);
- }
};
typedef
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97802.327563.patch
Type: text/x-patch
Size: 1304 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210302/aed6d648/attachment.bin>
More information about the libcxx-commits
mailing list