I saw on another thread that 4.9 release was getting closer. Applying this patch sounds like a good idear for this release.

Any feedback ?


On 12/27/2013 07:27 PM, François Dumont wrote:
Hi

Here is a patch to fix an issue in normal mode during the move assignment. The destination vector allocator instance is moved too during the assignment which is wrong.

As I discover this problem while working on issues with management of safe iterators during move operations this patch also fix those issues in the debug mode for the vector container. Fixes for other containers in debug mode will come later.

2013-12-27  François Dumont <fdum...@gcc.gnu.org>

    * include/bits/stl_vector.h (std::vector<>::_M_move_assign): Pass
    *this allocator instance when building temporary vector instance
    so that *this allocator do not get moved.
    * include/debug/safe_base.h
    (_Safe_sequence_base(_Safe_sequence_base&&)): New.
    * include/debug/vector (__gnu_debug::vector<>(vector&&)): Use
    latter.
    (__gnu_debug::vector<>(vector&&, const allocator_type&)): Swap
    safe iterators if the instance is moved.
    (__gnu_debug::vector<>::operator=(vector&&)): Likewise.
    * testsuite/23_containers/vector/allocator/move.cc (test01): Add
    check on a vector iterator.
    * testsuite/23_containers/vector/allocator/move_assign.cc
    (test02): Likewise.
    (test03): New, test with a non-propagating allocator.
    * testsuite/23_containers/vector/debug/move_assign_neg.cc: New.

Tested under Linux x86_64 normal and debug modes.

I will be in vacation for a week starting today so if you want to apply it quickly do not hesitate to do it yourself.

François


Reply via email to