[libcxx-commits] [libcxx] [libc++][ranges][abi-break] Fix `movable_box` overwriting memory of data that lives in the tail padding (PR #71314)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Dec 22 09:24:38 PST 2023


================
@@ -54,7 +54,8 @@ namespace ranges {
 
 template <forward_range _View, indirect_binary_predicate<iterator_t<_View>, iterator_t<_View>> _Pred>
   requires view<_View> && is_object_v<_Pred>
-class chunk_by_view : public view_interface<chunk_by_view<_View, _Pred>> {
+class _LIBCPP_ABI_2023_OVERLAPPING_SUBOBJECT_FIX_TAG chunk_by_view
+    : public view_interface<chunk_by_view<_View, _Pred>> {
   _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
   _LIBCPP_NO_UNIQUE_ADDRESS __movable_box<_Pred> __pred_;
 
----------------
ldionne wrote:

I think we should mark `__cached_begin_` with `NO_UNIQUE_ADDRESS` so that we can reuse the padding of the non-propagating-cache in some cases. We should add a simple test that this works.

https://github.com/llvm/llvm-project/pull/71314


More information about the libcxx-commits mailing list