* [committed] [gcc-12] libstdc++: avoid bogus -Wrestrict [PR105651]
@ 2023-06-21 12:22 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2023-06-21 12:22 UTC (permalink / raw)
To: libstdc++, gcc-patches; +Cc: Jason Merrill
I've pushed Jason's patch from https://gcc.gnu.org/PR105651#c17 to the
gcc-12 branch, because Jakub's fix on gcc-13 isn't possible to backport.
Tested x86_64-linux, pushed to gcc-12.
-- >8 --
PR tree-optimization/105651
libstdc++-v3/ChangeLog:
* include/bits/basic_string.tcc (_M_replace): Add an assert
to avoid -Wrestrict false positive.
---
libstdc++-v3/include/bits/basic_string.tcc | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc
index 0696b96604c..48fa28e6466 100644
--- a/libstdc++-v3/include/bits/basic_string.tcc
+++ b/libstdc++-v3/include/bits/basic_string.tcc
@@ -529,6 +529,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
const size_type __nleft = (__p + __len1) - __s;
this->_S_move(__p, __s, __nleft);
+ // Tell the middle-end that the copy can't overlap
+ // (PR105651).
+ if (__len2 < __nleft)
+ __builtin_unreachable();
this->_S_copy(__p + __nleft, __p + __len2,
__len2 - __nleft);
}
--
2.40.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-06-21 12:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-21 12:22 [committed] [gcc-12] libstdc++: avoid bogus -Wrestrict [PR105651] Jonathan Wakely
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).