Eric Fiselier
1d6b5d3ed1
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
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283408 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 22:55:10 +00:00
..
2016-09-16 02:16:23 +00:00
2016-04-22 01:04:55 +00:00
2016-09-29 03:35:41 +00:00
2016-03-09 15:39:39 +00:00
2016-03-09 15:39:39 +00:00
2016-10-05 22:55:10 +00:00
2016-09-26 22:19:41 +00:00
2016-07-23 20:36:55 +00:00
2016-08-25 15:09:01 +00:00
2016-09-22 00:23:15 +00:00
2015-08-26 20:15:02 +00:00
2016-09-25 04:05:46 +00:00
2016-09-15 22:27:07 +00:00
2016-07-18 17:23:06 +00:00
2015-10-08 20:34:11 +00:00
2015-11-07 01:22:13 +00:00
2015-07-18 20:40:46 +00:00
2016-09-15 22:27:07 +00:00
2016-09-13 09:32:32 +00:00
2016-08-27 19:32:03 +00:00
2016-08-29 20:43:38 +00:00
2016-07-12 14:39:13 +00:00
2016-07-12 14:39:13 +00:00
2016-08-28 22:14:37 +00:00
2016-08-25 17:47:09 +00:00
2016-08-25 15:09:01 +00:00
2016-07-23 01:43:53 +00:00
2016-09-02 21:02:11 +00:00
2016-04-04 22:49:20 +00:00
2015-10-08 20:37:11 +00:00
2015-10-08 21:17:21 +00:00
2015-10-08 20:37:44 +00:00
2015-11-30 05:39:30 +00:00
2015-10-08 20:38:53 +00:00
2016-09-01 19:46:02 +00:00
2016-10-01 20:38:44 +00:00
2016-10-01 20:38:31 +00:00
2015-10-09 00:26:50 +00:00
2015-11-07 01:22:13 +00:00
2015-10-08 20:41:26 +00:00
2015-10-09 00:26:50 +00:00
2016-09-01 21:09:19 +00:00
2016-08-29 20:43:38 +00:00
2016-02-10 00:59:02 +00:00
2015-10-09 00:26:50 +00:00
2016-02-10 00:59:02 +00:00
2015-10-09 19:57:37 +00:00
2016-08-25 15:09:01 +00:00
2015-11-06 06:30:12 +00:00
2016-09-06 21:25:27 +00:00
2015-11-06 06:30:12 +00:00
2016-07-21 03:20:17 +00:00
2016-08-25 15:09:01 +00:00
2016-09-22 00:23:15 +00:00
2016-08-25 15:09:01 +00:00
2016-09-26 20:20:00 +00:00
2016-07-21 05:31:24 +00:00
2016-04-21 23:00:33 +00:00
2016-02-20 00:19:45 +00:00
2016-09-16 00:00:48 +00:00
2016-09-25 03:34:28 +00:00
2016-01-13 16:32:00 +00:00
2016-07-21 03:20:17 +00:00
2016-09-15 22:27:07 +00:00
2016-08-17 05:58:40 +00:00
2016-09-24 06:27:28 +00:00
2016-09-25 03:34:28 +00:00
2015-10-13 22:13:33 +00:00
2016-09-04 09:55:12 +00:00
2016-09-28 22:28:51 +00:00
2016-07-26 14:29:45 +00:00
2016-09-16 00:00:48 +00:00
2016-07-21 03:20:17 +00:00
2015-11-07 01:22:13 +00:00
2016-09-25 03:34:28 +00:00
2016-08-25 15:09:01 +00:00
2016-09-25 03:34:28 +00:00
2015-11-26 01:24:04 +00:00
2015-11-06 06:30:12 +00:00
2016-04-13 17:02:23 +00:00
2016-09-16 02:09:26 +00:00
2016-07-21 03:20:17 +00:00
2016-02-20 00:16:41 +00:00
2015-10-09 00:26:50 +00:00
2016-09-06 21:25:27 +00:00
2016-09-26 20:20:00 +00:00
2015-10-09 01:29:09 +00:00
2015-11-06 06:30:12 +00:00
2016-09-16 00:00:48 +00:00
2016-10-03 23:40:48 +00:00
2016-08-25 17:47:09 +00:00
2016-02-11 23:51:02 +00:00
2016-09-24 17:36:14 +00:00
2016-09-11 21:46:40 +00:00
2016-07-25 04:32:07 +00:00
2016-09-26 20:55:02 +00:00
2016-10-05 22:55:10 +00:00
2016-09-26 21:39:38 +00:00
2016-04-22 01:04:55 +00:00
2016-08-29 01:43:41 +00:00
2016-09-16 00:13:55 +00:00
2016-09-15 22:27:07 +00:00
2016-02-10 00:59:02 +00:00
2015-10-09 19:57:37 +00:00