[libcxx] r214088 - Fix PR#20471. Add a cast in __align_it to ensure that the bit twiddling is done at the correct size. A better solution, IMHO, would be to declare vector<bool>::__bits_per_word as 'size_type', rather than 'unsigned', but that's a possible ABI change.

Marshall Clow mclow.lists at gmail.com
Mon Jul 28 08:02:42 PDT 2014


Author: marshall
Date: Mon Jul 28 10:02:42 2014
New Revision: 214088

URL: http://llvm.org/viewvc/llvm-project?rev=214088&view=rev
Log:
Fix PR#20471. Add a cast in __align_it to ensure that the bit twiddling is done at the correct size. A better solution, IMHO, would be to declare vector<bool>::__bits_per_word as 'size_type', rather than 'unsigned', but that's a possible ABI change.

Modified:
    libcxx/trunk/include/vector

Modified: libcxx/trunk/include/vector
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/vector?rev=214088&r1=214087&r2=214088&view=diff
==============================================================================
--- libcxx/trunk/include/vector (original)
+++ libcxx/trunk/include/vector Mon Jul 28 10:02:42 2014
@@ -2352,7 +2352,7 @@ private:
     void deallocate() _NOEXCEPT;
     _LIBCPP_INLINE_VISIBILITY
     static size_type __align_it(size_type __new_size) _NOEXCEPT
-        {return __new_size + (__bits_per_word-1) & ~(__bits_per_word-1);};
+        {return __new_size + (__bits_per_word-1) & ~((size_type)__bits_per_word-1);};
     _LIBCPP_INLINE_VISIBILITY  size_type __recommend(size_type __new_size) const;
     _LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n, bool __x);
     template <class _ForwardIterator>





More information about the cfe-commits mailing list