[PATCH] D58028: Always compare C++ typeinfo (based on libstdc++ implementation).
Martin Liška via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 11 00:36:18 PST 2019
marxin created this revision.
marxin added reviewers: llvm-commits, filcab, dexonsmith, pcc.
Herald added a subscriber: kubamracek.
Resending https://reviews.llvm.org/D56485
As seen here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88684#c4
GCC libstdc++v3 implementation is __GXX_MERGED_TYPEINFO_NAMES=0 for all targets.
Thus it should be always compared string-wise. And one needs to check for name[0] != '*' as seen in typeinfo
implementation:
libstdc++-v3/libsupc++/typeinfo
https://reviews.llvm.org/D58028
Files:
lib/sanitizer_common/sanitizer_platform.h
lib/ubsan/ubsan_type_hash_itanium.cc
Index: lib/ubsan/ubsan_type_hash_itanium.cc
===================================================================
--- lib/ubsan/ubsan_type_hash_itanium.cc
+++ lib/ubsan/ubsan_type_hash_itanium.cc
@@ -118,7 +118,7 @@
const abi::__class_type_info *Base,
sptr Offset) {
if (Derived->__type_name == Base->__type_name ||
- (SANITIZER_NON_UNIQUE_TYPEINFO &&
+ (Derived->__type_name[0] != '*' &&
!internal_strcmp(Derived->__type_name, Base->__type_name)))
return Offset == 0;
Index: lib/sanitizer_common/sanitizer_platform.h
===================================================================
--- lib/sanitizer_common/sanitizer_platform.h
+++ lib/sanitizer_common/sanitizer_platform.h
@@ -292,12 +292,6 @@
# define MSC_PREREQ(version) 0
#endif
-#if defined(__arm64__) && SANITIZER_IOS
-# define SANITIZER_NON_UNIQUE_TYPEINFO 1
-#else
-# define SANITIZER_NON_UNIQUE_TYPEINFO 0
-#endif
-
// On linux, some architectures had an ABI transition from 64-bit long double
// (ie. same as double) to 128-bit long double. On those, glibc symbols
// involving long doubles come in two versions, and we need to pass the
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58028.186190.patch
Type: text/x-patch
Size: 1205 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190211/0c43d23a/attachment-0001.bin>
More information about the llvm-commits
mailing list