From: "François Dumont" <frs.dumont@gmail.com>
To: libstdc++ <libstdc++@gcc.gnu.org>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: [PATCH] [11/12/13/14 Regression] ABI break in _Hash_node_value_base since GCC 11 [PR 111050]
Date: Sun, 10 Sep 2023 15:56:11 +0200 [thread overview]
Message-ID: <bf02c66f-a911-8ce0-9249-45bef80b418c@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1349 bytes --]
Following confirmation of the fix by TC here is the patch where I'm
simply adding a 'constexpr' on _M_next().
Please let me know this ChangeLog entry is correct. I would prefer this
patch to be assigned to 'TC' with me as co-author but I don't know how
to do such a thing. Unless I need to change my user git identity to do so ?
libstdc++: Add constexpr qualification to _Hash_node::_M_next()
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=1b6f0476837205932613ddb2b3429a55c26c409d
changed _Hash_node_value_base to no longer derive from
_Hash_node_base, which means
that its member functions expect _M_storage to be at a different
offset. So explosions
result if an out-of-line definition is emitted for any of the
member functions (say,
in a non-optimized build) and the resulting object file is then
linked with code built
using older version of GCC/libstdc++.
libstdc++-v3/ChangeLog:
* include/bits/hashtable_policy.h
(_Hash_node_value_base<>::_M_valptr(),
_Hash_node_value_base<>::_M_v())
Add [[__gnu__::__always_inline__]].
(_Hash_node<>::_M_next()): Add constexpr.
Co-authored-by: TC <rs2740@gmail.com>
Ok to commit and backport to GCC 11, 12, 13 branches ?
François
[-- Attachment #2: pr111050.patch --]
[-- Type: text/x-patch, Size: 1096 bytes --]
diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h
index 347d468ea86..101c5eb639c 100644
--- a/libstdc++-v3/include/bits/hashtable_policy.h
+++ b/libstdc++-v3/include/bits/hashtable_policy.h
@@ -327,18 +327,22 @@ namespace __detail
__gnu_cxx::__aligned_buffer<_Value> _M_storage;
+ [[__gnu__::__always_inline__]]
_Value*
_M_valptr() noexcept
{ return _M_storage._M_ptr(); }
+ [[__gnu__::__always_inline__]]
const _Value*
_M_valptr() const noexcept
{ return _M_storage._M_ptr(); }
+ [[__gnu__::__always_inline__]]
_Value&
_M_v() noexcept
{ return *_M_valptr(); }
+ [[__gnu__::__always_inline__]]
const _Value&
_M_v() const noexcept
{ return *_M_valptr(); }
@@ -372,7 +376,7 @@ namespace __detail
: _Hash_node_base
, _Hash_node_value<_Value, _Cache_hash_code>
{
- _Hash_node*
+ constexpr _Hash_node*
_M_next() const noexcept
{ return static_cast<_Hash_node*>(this->_M_nxt); }
};
next reply other threads:[~2023-09-10 13:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-10 13:56 François Dumont [this message]
2023-09-10 15:36 ` Sam James
2023-09-11 11:51 ` Jonathan Wakely
2023-09-11 17:19 ` François Dumont
2023-09-12 16:09 ` Jonathan Wakely
2023-09-14 4:46 ` François Dumont
2023-09-27 4:44 ` François Dumont
2023-09-28 16:18 ` Jonathan Wakely
2023-09-28 17:25 ` François Dumont
2023-09-29 9:53 ` Jonathan Wakely
2023-10-02 20:51 ` François Dumont
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=bf02c66f-a911-8ce0-9249-45bef80b418c@gmail.com \
--to=frs.dumont@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@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: link
Be 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).