This fixes an oversight in a previous commit that improved mdspan
related code. Because __size doesn't use __fwd_prod. Therefore,
__fwd_prod(__r) is only called with __r = 0, ..., __rank (exclusive).
Hence, one can shrink the size of __fwd_partial_prods.

libstdc++-v3/ChangeLog:

        * include/std/mdspan (__fwd_partial_prods): Reduce size of the
        array by 1 element.

Signed-off-by: Luc Grosheintz <luc.groshei...@gmail.com>
---
 libstdc++-v3/include/std/mdspan | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/std/mdspan b/libstdc++-v3/include/std/mdspan
index 351018a59a5..8f974257e96 100644
--- a/libstdc++-v3/include/std/mdspan
+++ b/libstdc++-v3/include/std/mdspan
@@ -274,8 +274,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       constexpr auto __fwd_partial_prods = [] consteval
        {
          constexpr size_t __rank = _Extents.size();
-         std::array<size_t, __rank + 1> __ret;
-         for(size_t __r = 0; __r < __rank + 1; ++__r)
+         std::array<size_t, __rank> __ret;
+         for(size_t __r = 0; __r < __rank; ++__r)
            __ret[__r] = __static_prod<_Extents>(0, __r);
          return __ret;
        }();
-- 
2.50.0

Reply via email to