public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/113200] std::char_traits<char>::move is not constexpr when the argument is a string literal Date: Fri, 05 Jan 2024 10:23:59 +0000 [thread overview] Message-ID: <bug-113200-4-k2NKrL2Okp@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-113200-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113200 --- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>: https://gcc.gnu.org/g:15cc291887dc9dd92b2c93f4545e20eb6c190122 commit r14-6944-g15cc291887dc9dd92b2c93f4545e20eb6c190122 Author: Jonathan Wakely <jwakely@redhat.com> Date: Wed Jan 3 15:01:09 2024 +0000 libstdc++: Fix std::char_traits<C>::move [PR113200] The current constexpr implementation of std::char_traits<C>::move relies on being able to compare the pointer parameters, which is not allowed for unrelated pointers. We can use __builtin_constant_p to determine whether it's safe to compare the pointers directly. If not, then we know the ranges must be disjoint and so we can use char_traits<C>::copy to copy forwards from the first character to the last. If the pointers can be compared directly, then we can simplify the condition for copying backwards to just two pointer comparisons. libstdc++-v3/ChangeLog: PR libstdc++/113200 * include/bits/char_traits.h (__gnu_cxx::char_traits::move): Use __builtin_constant_p to check for unrelated pointers that cannot be compared during constant evaluation. * testsuite/21_strings/char_traits/requirements/113200.cc: New test.
next prev parent reply other threads:[~2024-01-05 10:24 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-01-02 15:41 [Bug libstdc++/113200] New: " pdimov at gmail dot com 2024-01-02 16:45 ` [Bug c++/113200] " pinskia at gcc dot gnu.org 2024-01-02 16:47 ` [Bug libstdc++/113200] " pinskia at gcc dot gnu.org 2024-01-02 16:49 ` pdimov at gmail dot com 2024-01-02 16:51 ` pdimov at gmail dot com 2024-01-03 11:13 ` [Bug c++/113200] " redi at gcc dot gnu.org 2024-01-03 11:23 ` [Bug libstdc++/113200] " redi at gcc dot gnu.org 2024-01-03 12:57 ` redi at gcc dot gnu.org 2024-01-03 13:01 ` redi at gcc dot gnu.org 2024-01-04 1:58 ` de34 at live dot cn 2024-01-05 10:23 ` cvs-commit at gcc dot gnu.org [this message] 2024-01-05 11:46 ` redi at gcc dot gnu.org 2024-01-06 13:40 ` cvs-commit at gcc dot gnu.org 2024-01-11 23:16 ` cvs-commit at gcc dot gnu.org 2024-01-11 23:17 ` redi at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-113200-4-k2NKrL2Okp@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).