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++/110060] [14 Regression] Adding optimizer hints to std::vector causes a new -Wstringop-overread false positive Date: Thu, 01 Jun 2023 15:09:45 +0000 [thread overview] Message-ID: <bug-110060-4-QwxuGPMw5Z@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-110060-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110060 --- Comment #9 from CVS 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:b7b255e77a271974479c34d1db3daafc04b920bc commit r14-1470-gb7b255e77a271974479c34d1db3daafc04b920bc Author: Jonathan Wakely <jwakely@redhat.com> Date: Thu Jun 1 10:26:10 2023 +0100 libstdc++: Fix code size regressions in std::vector [PR110060] My r14-1452-gfb409a15d9babc change to add optimization hints to std::vector causes regressions because it makes std::vector::size() and std::vector::capacity() too big to inline. That's the opposite of what I wanted, so revert the changes to those functions. To achieve the original aim of optimizing vec.assign(vec.size(), x) we can add a local optimization hint to _M_fill_assign, so that it doesn't affect all other uses of size() and capacity(). Additionally, add the same hint to the _M_assign_aux overload for forward iterators and add that to the testcase. It would be nice to similarly optimize: if (vec1.size() == vec2.size()) vec1 = vec2; but adding hints to operator=(const vector&) doesn't help. Presumably the relationships between the two sizes and two capacities are too complex to track effectively. libstdc++-v3/ChangeLog: PR libstdc++/110060 * include/bits/stl_vector.h (_Vector_base::_M_invariant): Remove. (vector::size, vector::capacity): Remove calls to _M_invariant. * include/bits/vector.tcc (vector::_M_fill_assign): Add optimization hint to reallocating path. (vector::_M_assign_aux(FwdIter, FwdIter, forward_iterator_tag)): Likewise. * testsuite/23_containers/vector/capacity/invariant.cc: Moved to... * testsuite/23_containers/vector/modifiers/assign/no_realloc.cc: ...here. Check assign(FwdIter, FwdIter) too. * testsuite/23_containers/vector/types/1.cc: Revert addition of -Wno-stringop-overread option.
next prev parent reply other threads:[~2023-06-01 15:09 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-31 11:59 [Bug tree-optimization/110060] New: " redi at gcc dot gnu.org 2023-05-31 22:53 ` [Bug tree-optimization/110060] " pinskia at gcc dot gnu.org 2023-05-31 23:07 ` redi at gcc dot gnu.org 2023-05-31 23:16 ` pinskia at gcc dot gnu.org 2023-05-31 23:31 ` pinskia at gcc dot gnu.org 2023-05-31 23:32 ` redi at gcc dot gnu.org 2023-05-31 23:38 ` pinskia at gcc dot gnu.org 2023-06-01 8:37 ` redi at gcc dot gnu.org 2023-06-01 9:35 ` [Bug libstdc++/110060] [14 Regression] " redi at gcc dot gnu.org 2023-06-01 15:09 ` cvs-commit at gcc dot gnu.org [this message] 2023-06-01 15:11 ` 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-110060-4-QwxuGPMw5Z@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).