[PATCH] libstdc++/98466 Fix _GLIBCXX_DEBUG N3644 integration
François Dumont
frs.dumont@gmail.com
Thu Jan 14 18:34:11 GMT 2021
On 14/01/21 6:15 pm, Jonathan Wakely wrote:
> On 14/01/21 17:10 +0000, Jonathan Wakely wrote:
>> On 01/01/21 18:51 +0100, François Dumont via Libstdc++ wrote:
>>> I think the PR is not limited to unordered containers iterator, it
>>> impacts all _GLIBCXX_DEBUG iterators.
>>>
>>> However unordered containers local_iterator was more complicated to
>>> handle. Because of c++/65816 I prefer to review
>>> _Node_iterator_default constructor to set _M_cur to nullptr even if
>>> in principle it is not necessary except for the _Local_iterator_base
>>> constructor when hash code is not cached.
>>>
>>> Â Â Â libstdc++: Implement N3644 for _GLIBCXX_DEBUG iterators
>>>
>>> Â Â Â libstdc++-v3/ChangeLog
>>>
>>> Â Â Â Â Â Â Â Â Â Â Â PR libstdc++/98466
>>> Â Â Â Â Â Â Â Â Â Â Â * include/bits/hashtable_policy.h
>>> (_Node_iterator_base()): Set _M_cur to nullptr.
>>> Â Â Â Â Â Â Â Â Â Â Â (_Node_iterator()): Make default.
>>> Â Â Â Â Â Â Â Â Â Â Â (_Node_const_iterator()): Make default.
>>> Â Â Â Â Â Â Â Â Â Â Â * include/debug/macros.h
>>> (__glibcxx_check_erae_range_after): Add _M_singular
>>> Â Â Â Â Â Â Â Â Â Â Â iterator checks.
>>> Â Â Â Â Â Â Â Â Â Â Â * include/debug/safe_iterator.h
>>> Â Â Â Â Â Â Â Â Â Â Â (_GLIBCXX_DEBUG_VERIFY_OPERANDS): Accept if
>>> both iterator are value initialized.
>>> Â Â Â Â Â Â Â Â Â Â Â * include/debug/safe_local_iterator.h
>>> (_GLIBCXX_DEBUG_VERIFY_OPERANDS):
>>> Â Â Â Â Â Â Â Â Â Â Â Likewise.
>>> Â Â Â Â Â Â Â Â Â Â Â * include/debug/safe_iterator.tcc
>>> (_Safe_iterator<>::_M_valid_range): Add
>>> Â Â Â Â Â Â Â Â Â Â Â _M_singular checks on input iterators.
>>> Â Â Â Â Â Â Â Â Â Â Â * src/c++11/debug.cc
>>> (_Safe_iterator_base::_M_can_compare): Remove _M_singular
>>> Â Â Â Â Â Â Â Â Â Â Â checks.
>>> Â Â Â Â Â Â Â Â Â Â Â *
>>> testsuite/23_containers/deque/debug/98466.cc: New test.
>>> Â Â Â Â Â Â Â Â Â Â Â *
>>> testsuite/23_containers/unordered_map/debug/98466.cc: New test.
>>>
>>> Tested under Linux x86_64 normal and debug mode.
>>>
>>> Ok to commit ?
>>
>> Yes, thanks.
>
> I've just realised that this C++14 change used to be noted in the
> C++14 status table:
>
> <row>
> <?dbhtml bgcolor="#B0B0B0" ?>
> <entry>
> <link xmlns:xlink="http://www.w3.org/1999/xlink"
> xlink:href="http://www.open-std.org/JTC1/sc22/WG21/docs/papers/2013/n3644.pdf">
> N3644
> </link>
> </entry>
> <entry>Null Forward Iterators</entry>
> <entry>Partial</entry>
> <entry>Only affects Debug Mode</entry>
> </row>
>
> But I removed that last year when replacing the list of proposals with
> the Table of Contents taken from the standard, in commit
> 57ede05c6a0b443943e312bf205cb79233c9396f (oops!)
>
> For the branches we should either document that missing feature in a
> note, or backport your fix in a few weeks.
>
>
>
I'll keep the backport in my TODOs.
More information about the Libstdc++
mailing list