Hi Attached patch applied as trivial.
2017-10-16 François Dumont <fdum...@gcc.gnu.org> PR libstdc++/82558 * include/bits/stl_bvector.h (fill): Add iterator offset check. * testsuite/23_containers/vector/bool/82558.cc: New. Thanks for the report. François On 16/10/2017 07:25, fdumont at gcc dot gnu.org wrote:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82558 François Dumont <fdumont at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |fdumont at gcc dot gnu.org
Index: include/bits/stl_bvector.h =================================================================== --- include/bits/stl_bvector.h (revision 253775) +++ include/bits/stl_bvector.h (working copy) @@ -417,7 +417,7 @@ if (__last._M_offset != 0) __fill_bvector(__last._M_p, 0, __last._M_offset, __x); } - else + else if (__first._M_offset != __last._M_offset) __fill_bvector(__first._M_p, __first._M_offset, __last._M_offset, __x); } Index: testsuite/23_containers/vector/bool/82558.cc =================================================================== --- testsuite/23_containers/vector/bool/82558.cc (nonexistent) +++ testsuite/23_containers/vector/bool/82558.cc (working copy) @@ -0,0 +1,32 @@ +// Copyright (C) 2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// 23.3.8 class vector<bool> + +#include <vector> + +// libstdc++/82558 +void test01() +{ + std::vector<bool> v; + std::fill(v.begin(), v.begin(), false); +} + +int main() +{ + test01(); +}