[PATCH] Fix algo constexpr tests in Debug mode

Jonathan Wakely jwakely@redhat.com
Wed Oct 23 16:02:00 GMT 2019


On 28/09/19 23:12 +0200, François Dumont wrote:
>Here is what I just commited.
>
>I try to use the asm trick in the _GLIBCXX_DEBUG_VERIFY_COND_AT but 
>didn't notice any enhancement. So for now I kept my solution to just 
>have a non-constexpr call compiler error.
>
>I fix my patch to use __builtin_is_constant_evaluated rather than 
>std::is_constant_evaluated in __valid_range.
>
>    * include/bits/stl_algobase.h (__memmove): Return _Tp*.
>    (__memmove): Loop as long as __n is not 0.
>    (__copy_move<>::__copy_m): Likewise.
>    (__copy_move_backward<>::__copy_move_b): Likewise.
>    * testsuite/25_algorithms/copy/constexpr.cc: Add check on copied 
>values.
>    * testsuite/25_algorithms/copy_backward/constexpr.cc: Likewise.
>    * testsuite/25_algorithms/copy/constexpr_neg.cc: New.
>    * testsuite/25_algorithms/copy_backward/constexpr.cc: New.
>
>    * include/debug/forward_list
>(_Sequence_traits<__debug::forward_list<>>::_S_size): Returns __dp_sign
>    distance when not empty.
>    * include/debug/list
>    (_Sequence_traits<__debug::list<>>::_S_size): Likewise.
>    * include/debug/helper_functions.h (__dp_sign_max_size): New
>    _Distance_precision enum entry.
>    * include/debug/safe_iterator.h
>    (__copy_move_a(_II, _II, const _Safe_iterator<>&)): Check for output
>    iterator _M_can_advance as soon as input range distance precision is
>    strictly higher than __dp_size.
>    (__copy_move_a(const _Safe_iterator<>&, const _Safe_iterator<>&,
>    const _Safe_iterator<>&)): Likewise.
>    (__copy_move_backward_a(_II, _II, const _Safe_iterator<>&)): Likewise.
>    (__copy_move_backward_a(const _Safe_iterator<>&,
>    const _Safe_iterator<>&, const _Safe_iterator<>&)): Likewise.
>    (__equal_aux(_II, _II, const _Safe_iterator<>&)): Likewise.
>    (__equal_aux(const _Safe_iterator<>&,
>    const _Safe_iterator<>&, const _Safe_iterator<>&)): Likewise.

I'm going to commit this small fix.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 937 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20191023/70dde877/attachment.bin>


More information about the Gcc-patches mailing list