Go to file
Eric Fiselier ae34c56ee7 Fix strict-aliasing violation in typeinfo::hash_code()
Summary:
The current implementation of `hash_code()` for uniqued RTTI strings violates strict aliasing by dereferencing a type-punned pointer. Specifically it generates a `const char**` pointer from the address of the `__name` member before casting it to `const size_t*` and dereferencing it to get the hash. This is really just a complex and incorrect way of writing `reinterpret_cast<size_t>(__name)`.

This patch changes the conversion sequence so that it no longer contains UB.


Reviewers: howard.hinnant, mclow.lists

Subscribers: rjmccall, cfe-commits

Differential Revision: https://reviews.llvm.org/D24012

llvm-svn: 283408
2016-10-05 22:55:10 +00:00
clang PR22924, PR22845, some of CWG1464: When checking the initializer for an array 2016-10-05 22:41:02 +00:00
clang-tools-extra [change-namespace] Pass Style to ChangeNamespaceTool. 2016-10-05 17:00:40 +00:00
compiler-rt [compiler-rt] Enable building iOS by default. 2016-10-05 20:45:36 +00:00
debuginfo-tests New round of fixes for "Always compile debuginfo-tests for the host triple" 2014-10-18 23:47:59 +00:00
libclc Provide vstore_half helper to workaround clc restrictions 2016-09-21 20:15:55 +00:00
libcxx Fix strict-aliasing violation in typeinfo::hash_code() 2016-10-05 22:55:10 +00:00
libcxxabi [CMake] Fix libc++abi standalone cmake build. 2016-10-03 11:08:17 +00:00
libunwind libunwind: Add OpenBSD case for _Unwind_Ptr typedef 2016-09-28 15:37:21 +00:00
lld Add exact number of streams for reserved stream #s. 2016-10-05 22:08:58 +00:00
lldb Add i386/x86_64 tests of the eh_frame augmentation code in the x86 2016-10-05 22:37:01 +00:00
llgo [llgo] add llgo source path to LLVM_GO_PACKAGES 2016-07-27 03:01:00 +00:00
llvm Fix tests for Windows 2016-10-05 22:48:13 +00:00
openmp [cmake] Fix for a bug https://llvm.org/bugs/show_bug.cgi?id=30489 "Cannot build with -DLIBOMP_FORTRAN_MODULES=True" 2016-09-30 22:05:45 +00:00
parallel-libs [SE] Change CoreTests target name 2016-09-27 15:32:52 +00:00
polly Build and run isl_test as part of check-polly 2016-10-04 19:48:40 +00:00