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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #5)
> (In reply to Michael Ragazzon from comment #1)
> > I seem to also have encountered this issue while using `std::vector<bool>`.
> 
> I think comment 1 is Bug 114758 which is slightly different.

Actually, maybe not, because my fix for that bug doesn't help here, and this
gives an warning even with -fassume-sane-operators-new-delete

#include <vector>

void f(std::vector<bool>& v)
{
  // Warning emitted when set to any number in the range [1,64].
  v.reserve(30);
  v.push_back(0);
}


.../15.0.1/bits/stl_algobase.h:426:32: warning: 'void* __builtin_memmove(void*,
const void*, long unsigned int)' forming offset 8 is out of the bounds [0, 8]
[-Warray-bounds=]
  426 |               __builtin_memmove(_GLIBCXX_TO_ADDR(__result),
      |               ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  427 |                                 _GLIBCXX_TO_ADDR(__first),
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~
  428 |                                 __n * sizeof(*__first));
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to