aboutsummaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2021-11-18 12:39:20 +0000
committerJonathan Wakely <jwakely@redhat.com>2021-11-18 16:14:15 +0000
commitca243ada71656651a8753e88164a1f0f019be1c3 (patch)
tree1818ddadb761c14d7987a57b6fffae8fbb9655cb /gcc/varasm.c
parent16fab6d691b1410abdf794230246ab9753d183af (diff)
downloadgcc-ca243ada71656651a8753e88164a1f0f019be1c3.zip
gcc-ca243ada71656651a8753e88164a1f0f019be1c3.tar.gz
gcc-ca243ada71656651a8753e88164a1f0f019be1c3.tar.bz2
libstdc++: Fix std::char_traits<C>::move for constexpr
The constexpr branch in __gnu_cxx::char_traits::move compares the string arguments to see if they overlap, but relational comparisons between unrelated pointers are not core constant expressions. I want to replace the comparisons with a loop using pointer equality to determine whether the end of the source string is in the destination string. However, that doesn't work with GCC, due to PR c++/89074 so allocate a temporary buffer instead and copy out into that first, so that overlapping source and destination don't matter. The allocation isn't supported by the current Intel icc so use the loop as a fallback. libstdc++-v3/ChangeLog: * include/bits/char_traits.h (__gnu_cxx::char_traits::move): Do not compare unrelated pointers during constant evaluation. * testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc: Improve tests for char_traits::move.
Diffstat (limited to 'gcc/varasm.c')
0 files changed, 0 insertions, 0 deletions