From patchwork Sun Sep 10 13:56:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Fran=C3=A7ois_Dumont?= X-Patchwork-Id: 1832035 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=Z2DoqAj8; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RkBGb0gtXz1yhZ for ; Sun, 10 Sep 2023 23:56:38 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E7D093858425 for ; Sun, 10 Sep 2023 13:56:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E7D093858425 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694354196; bh=FDJtHpMd1rx2yxIcWaI4kHwFDGS5fmd5n/xs8GeBalQ=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=Z2DoqAj8lz0DH15oyX8IfasgRslMmjQfMtqmdPWrcSQd8q9LQzHohnmUXecIP+lEF 91aNpGsT5S+lzRD84Er8cYwpEDh7c5ntNGhusFZVC2ZwZFyHa1jMheWB+BhByQ8lnx NefSpcHKcV1ZAWNl9ZF0oPJpiadm0w1ksG8dhJKQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by sourceware.org (Postfix) with ESMTPS id DE2A23858D33; Sun, 10 Sep 2023 13:56:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DE2A23858D33 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4018af1038cso39361755e9.0; Sun, 10 Sep 2023 06:56:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694354172; x=1694958972; h=subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FDJtHpMd1rx2yxIcWaI4kHwFDGS5fmd5n/xs8GeBalQ=; b=ZF6oMvUpZPKu8S8+FEuazCGyf8a39Ymcce7l/Tjgzfhq1AaFoQoInAQ6l+JXGi8hVn dXBjCgVLw6HbXA2IUaQx5FBCRMQWvr6Tvo06FeW++fP0U5WCJQdUu/U/tuQgSDH94yLS dCQgEgnwyPuXL7hD0AN8NoaJI1hpLr4zCmUJZgFVsy4gMfolj3VBL1160jHT7nW/NcMH UeARXlW5zlI+CCWK8ifiLfqEe6lMy7lvoPcusfz/ItT/HGFqfi4zCXUEjHLx7lBErQ7/ W58Ri97I45SWIwRHDPwbTrEm2g06Li9j3giRQqJCzc+6FNyKQ1aWyyCLu4zSWevXa1E1 XvNw== X-Gm-Message-State: AOJu0YyGpJEpe1c9u+FryQC0yO7nImFmwCm7YajDDzAwVMv47s+VzkZr sEId0rSKTgn9Epoz6LiXAEXIUJRbNFw= X-Google-Smtp-Source: AGHT+IFc/otkvC8JOeQpHD7r+IhfxOSnsoAsoSN52GDHza45dp0OMMI7AL1p3Fnu9rvZlaiJm7/T4Q== X-Received: by 2002:a05:600c:1c98:b0:400:57d1:4915 with SMTP id k24-20020a05600c1c9800b0040057d14915mr6655788wms.37.1694354172374; Sun, 10 Sep 2023 06:56:12 -0700 (PDT) Received: from ?IPV6:2a01:e0a:1dc:b1c0:53f:e49b:d21d:e117? ([2a01:e0a:1dc:b1c0:53f:e49b:d21d:e117]) by smtp.gmail.com with ESMTPSA id d13-20020adff84d000000b00317909f9985sm7340499wrq.113.2023.09.10.06.56.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 10 Sep 2023 06:56:11 -0700 (PDT) Message-ID: Date: Sun, 10 Sep 2023 15:56:11 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Content-Language: en-US To: libstdc++ Cc: gcc-patches Subject: [PATCH] [11/12/13/14 Regression] ABI break in _Hash_node_value_base since GCC 11 [PR 111050] X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Fran=C3=A7ois_Dumont_via_Gcc-patches?= From: =?utf-8?q?Fran=C3=A7ois_Dumont?= Reply-To: =?utf-8?q?Fran=C3=A7ois_Dumont?= Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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 Ok to commit and backport to GCC 11, 12, 13 branches ? François 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); } };