https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111073

Rogério de Souza Moraes <rogerio.souza at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rogerio.souza at gmail dot com

--- Comment #6 from Rogério de Souza Moraes <rogerio.souza at gmail dot com> ---
We got similar issue with a very small code using GCC v14.2:

https://godbolt.org/z/b5dqvnKqj

**********************

#include <vector>

void foo(int mod_id, std::vector<std::vector<int>> &_modMpcCluster) {
     std::vector<int> cluster;
     cluster.push_back(mod_id);
     _modMpcCluster.push_back(cluster);
}

**********************

g++ -c -fpic -std=c++26 -O -DNDEBUG -Wall -Werror xxx.cpp

This returns the error:

```
In file included from
/opt/compiler-explorer/gcc-14.2.0/include/c++/14.2.0/vector:62,
                 from <source>:1:
In static member function 'static constexpr _Up* std::__copy_move<_IsMove,
true, std::random_access_iterator_tag>::__copy_m(_Tp*, _Tp*, _Up*) [with _Tp =
const int; _Up = int; bool _IsMove = false]',
    inlined from 'constexpr _OI std::__copy_move_a2(_II, _II, _OI) [with bool
_IsMove = false; _II = const int*; _OI = int*]' at
/opt/compiler-explorer/gcc-14.2.0/include/c++/14.2.0/bits/stl_algobase.h:521:30,
    inlined from 'constexpr _OI std::__copy_move_a1(_II, _II, _OI) [with bool
_IsMove = false; _II = const int*; _OI = int*]' at
/opt/compiler-explorer/gcc-14.2.0/include/c++/14.2.0/bits/stl_algobase.h:548:42,
    inlined from 'constexpr _OI std::__copy_move_a(_II, _II, _OI) [with bool
_IsMove = false; _II = __gnu_cxx::__normal_iterator<const int*, vector<int> >;
_OI = int*]' at
/opt/compiler-explorer/gcc-14.2.0/include/c++/14.2.0/bits/stl_algobase.h:555:31,
    inlined from 'constexpr _OI std::copy(_II, _II, _OI) [with _II =
__gnu_cxx::__normal_iterator<const int*, vector<int> >; _OI = int*]' at
/opt/compiler-explorer/gcc-14.2.0/include/c++/14.2.0/bits/stl_algobase.h:651:7,
    inlined from 'static _ForwardIterator
std::__uninitialized_copy<true>::__uninit_copy(_InputIterator, _InputIterator,
_ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator<const
int*, std::vector<int> >; _ForwardIterator = int*]' at
/opt/compiler-explorer/gcc-14.2.0/include/c++/14.2.0/bits/stl_uninitialized.h:147:27,
    inlined from '_ForwardIterator std::uninitialized_copy(_InputIterator,
_InputIterator, _ForwardIterator) [with _InputIterator =
__gnu_cxx::__normal_iterator<const int*, vector<int> >; _ForwardIterator =
int*]' at
/opt/compiler-explorer/gcc-14.2.0/include/c++/14.2.0/bits/stl_uninitialized.h:185:15,
    inlined from 'constexpr _ForwardIterator
std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator,
allocator<_Tp>&) [with _InputIterator = __gnu_cxx::__normal_iterator<const
int*, vector<int> >; _ForwardIterator = int*; _Tp = int]' at
/opt/compiler-explorer/gcc-14.2.0/include/c++/14.2.0/bits/stl_uninitialized.h:373:37,
    inlined from 'constexpr std::vector<_Tp, _Alloc>::vector(const
std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]' at
/opt/compiler-explorer/gcc-14.2.0/include/c++/14.2.0/bits/stl_vector.h:606:31,
    inlined from 'constexpr decltype (::new(void*(0)) _Tp)
std::construct_at(_Tp*, _Args&& ...) [with _Tp = vector<int>; _Args = {const
vector<int, allocator<int> >&}]' at
/opt/compiler-explorer/gcc-14.2.0/include/c++/14.2.0/bits/stl_construct.h:97:14,
    inlined from 'static constexpr void
std::allocator_traits<std::allocator<_Up> >::construct(allocator_type&, _Up*,
_Args&& ...) [with _Up = std::vector<int>; _Args = {const std::vector<int,
std::allocator<int> >&}; _Tp = std::vector<int>]' at
/opt/compiler-explorer/gcc-14.2.0/include/c++/14.2.0/bits/alloc_traits.h:536:21,
    inlined from 'constexpr void std::vector<_Tp, _Alloc>::push_back(const
value_type&) [with _Tp = std::vector<int>; _Alloc =
std::allocator<std::vector<int> >]' at
/opt/compiler-explorer/gcc-14.2.0/include/c++/14.2.0/bits/stl_vector.h:1288:30,
    inlined from 'void foo(int, std::vector<std::vector<int> >&)' at
<source>:6:30:
/opt/compiler-explorer/gcc-14.2.0/include/c++/14.2.0/bits/stl_algobase.h:452:30:
error: 'void* __builtin_memmove(void*, const void*, long unsigned int)' forming
offset 4 is out of the bounds [0, 4] [-Werror=array-bounds=]
  452 |             __builtin_memmove(__result, __first, sizeof(_Tp) * _Num);
      |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
```

Reply via email to