[libcxx-commits] [libcxx] [libc++][hardening] Don't trigger redundant checks in the fast mode. (PR #77176)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 9 13:29:22 PST 2024


================
@@ -152,8 +152,9 @@ class layout_left::mapping {
     // return a value exceeding required_span_size(), which is used to know how large an allocation one needs
     // Thus, this is a canonical point in multi-dimensional data structures to make invalid element access checks
     // However, mdspan does check this on its own, so for now we avoid double checking in hardened mode
-    _LIBCPP_ASSERT_UNCATEGORIZED(__mdspan_detail::__is_multidimensional_index_in(__extents_, __idx...),
-                                 "layout_left::mapping: out of bounds indexing");
+    _LIBCPP_REDUNDANT_ASSERTION( //
----------------
ldionne wrote:

I think what you did is the right call. It seems more likely to me that `mdspan` is used with a custom mapping than a mapping being used with another data structure.

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


More information about the libcxx-commits mailing list