[libcxx] r322031 - Make rehash(0) work with ubsan's unsigned-integer-overflow.
Dan Albert via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 8 13:49:12 PST 2018
Author: danalbert
Date: Mon Jan 8 13:49:12 2018
New Revision: 322031
URL: http://llvm.org/viewvc/llvm-project?rev=322031&view=rev
Log:
Make rehash(0) work with ubsan's unsigned-integer-overflow.
Reviewers: mclow.lists, EricWF
Reviewed By: mclow.lists
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D40743
Modified:
libcxx/trunk/include/__hash_table
Modified: libcxx/trunk/include/__hash_table
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__hash_table?rev=322031&r1=322030&r2=322031&view=diff
==============================================================================
--- libcxx/trunk/include/__hash_table (original)
+++ libcxx/trunk/include/__hash_table Mon Jan 8 13:49:12 2018
@@ -2136,7 +2136,7 @@ template <class _Tp, class _Hash, class
void
__hash_table<_Tp, _Hash, _Equal, _Alloc>::rehash(size_type __n)
{
- if (__n == 1)
+ if (__n < 2)
__n = 2;
else if (__n & (__n - 1))
__n = __next_prime(__n);
More information about the cfe-commits
mailing list