https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62196
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- I've added some additional precondition checks to <valarray>. If you compile the original testcase with -D_GLIBCXX_ASSERTIONS it will abort at runtime now: $ ./a.out abcdefghijklmnopqrstuvwxyz /home/jwakely/gcc/13/include/c++/13.0.1/bits/mask_array.h:171: void std::mask_array<_Tp>::operator=(const std::valarray<_Tp>&) const [with _Tp = char]: Assertion '__v.size() == _M_sz' failed. Aborted (core dumped)