get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.1/patches/2226251/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2226251,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2226251/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/bmm.hhubh97i3e.gcc.gcc-TEST.redi.23.1.1@forge-stage.sourceware.org/",
    "project": {
        "id": 17,
        "url": "http://patchwork.ozlabs.org/api/1.1/projects/17/?format=api",
        "name": "GNU Compiler Collection",
        "link_name": "gcc",
        "list_id": "gcc-patches.gcc.gnu.org",
        "list_email": "gcc-patches@gcc.gnu.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null
    },
    "msgid": "<bmm.hhubh97i3e.gcc.gcc-TEST.redi.23.1.1@forge-stage.sourceware.org>",
    "date": "2026-04-22T10:34:03",
    "name": "[v1,1/1] libstdc++: Fix invalid casts in unordered container merge functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "2857f4287e5b86439b24f301a998d26a298265c8",
    "submitter": {
        "id": 93210,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/93210/?format=api",
        "name": "Jonathan Wakely via Sourceware Forge",
        "email": "forge-bot+redi@forge-stage.sourceware.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/bmm.hhubh97i3e.gcc.gcc-TEST.redi.23.1.1@forge-stage.sourceware.org/mbox/",
    "series": [
        {
            "id": 500976,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/500976/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=500976",
            "date": "2026-04-22T10:34:03",
            "name": "libstdc++: Fix invalid casts in unordered container merge functions",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/500976/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2226251/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2226251/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "gcc-patches@gcc.gnu.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@legolas.ozlabs.org",
            "gcc-patches@gcc.gnu.org"
        ],
        "Authentication-Results": [
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)",
            "sourceware.org; dmarc=none (p=none dis=none)\n header.from=forge-stage.sourceware.org",
            "sourceware.org;\n spf=pass smtp.mailfrom=forge-stage.sourceware.org",
            "server2.sourceware.org;\n arc=none smtp.remote-ip=38.145.34.39"
        ],
        "Received": [
            "from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g0wsW3b0jz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 20:47:27 +1000 (AEST)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 9E00648FF195\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 10:47:23 +0000 (GMT)",
            "from forge-stage.sourceware.org (vm08.sourceware.org [38.145.34.39])\n by sourceware.org (Postfix) with ESMTPS id 7D229436FA09\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 10:34:54 +0000 (GMT)",
            "from forge-stage.sourceware.org (localhost [IPv6:::1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256)\n (No client certificate requested)\n by forge-stage.sourceware.org (Postfix) with ESMTPS id 582B242B3B\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 10:34:54 +0000 (UTC)"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org 9E00648FF195",
            "OpenDKIM Filter v2.11.0 sourceware.org 7D229436FA09"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 7D229436FA09",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 7D229436FA09",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776854094; cv=none;\n b=pA2z/DZ1Z3mMJMaTNGPAhMnJVs3VdwOSVhDqyRfVJ59LgENK7ndXQnlSRt+vzl5Yz/TDe0wrVoyFtayC15PMNuhZn1kofXDZ4pRPZZJu8eEzuFhUbi/rnLxjVJVoCLUcjrICh39N8lU49R0HeiOcvRjZmMW8Aw7UWJQMR49nbWc=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776854094; c=relaxed/simple;\n bh=65UJEAy+RURIju9AEhn7bydOYzyUJzLZL0cx7pwNR+o=;\n h=From:Date:Subject:MIME-Version:To:Message-ID;\n b=Humd7lnKgqsv/EwsPr6ZopXdh0pEukswl+vx6c/8ucd3iOx+kPQ+sC/V6rArj1rxE2tKuAV2R5lsq2yOhyyb6ovDveN8O0MTGOfoe8PA4BgOajG8l7KNVROWbr8Zl5evwzTcJKAES2Dy/9qSQ8GoHqzL+GCGpB7sjUonkLvfGGw=",
        "ARC-Authentication-Results": "i=1; server2.sourceware.org",
        "From": "Jonathan Wakely via Sourceware Forge\n <forge-bot+redi@forge-stage.sourceware.org>",
        "Date": "Wed, 22 Apr 2026 10:34:03 +0000",
        "Subject": "[PATCH v1 1/1] libstdc++: Fix invalid casts in unordered container\n merge functions",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "To": "gcc-patches mailing list <gcc-patches@gcc.gnu.org>",
        "Message-ID": "\n <bmm.hhubh97i3e.gcc.gcc-TEST.redi.23.1.1@forge-stage.sourceware.org>",
        "X-Mailer": "batrachomyomachia",
        "X-Requested-Reviewer": "fdumont",
        "X-Pull-Request-Organization": "gcc",
        "X-Pull-Request-Repository": "gcc-TEST",
        "X-Pull-Request": "https://forge.sourceware.org/gcc/gcc-TEST/pulls/23",
        "References": "\n <bmm.hhubh97i3e.gcc.gcc-TEST.redi.23.1.0@forge-stage.sourceware.org>",
        "In-Reply-To": "\n <bmm.hhubh97i3e.gcc.gcc-TEST.redi.23.1.0@forge-stage.sourceware.org>",
        "X-Patch-URL": "\n https://forge.sourceware.org/redi/gcc/commit/ce349808c89f628f8e01cdd58fb9f9de13788bca",
        "X-BeenThere": "gcc-patches@gcc.gnu.org",
        "X-Mailman-Version": "2.1.30",
        "Precedence": "list",
        "List-Id": "Gcc-patches mailing list <gcc-patches.gcc.gnu.org>",
        "List-Unsubscribe": "<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>",
        "List-Archive": "<https://gcc.gnu.org/pipermail/gcc-patches/>",
        "List-Post": "<mailto:gcc-patches@gcc.gnu.org>",
        "List-Help": "<mailto:gcc-patches-request@gcc.gnu.org?subject=help>",
        "List-Subscribe": "<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>",
        "Reply-To": "gcc-patches mailing list <gcc-patches@gcc.gnu.org>, redi@gcc.gnu.org",
        "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"
    },
    "content": "From: Jonathan Wakely <jwakely@redhat.com>\n\nFrançois pointed out that static_cast<__node_ptr>(&_M_before_begin) is\ninvalid, because _M_before_begin is only a node-base not a node.\n\nRefactor the new merge overloads to only cast when we know we have a\nvalid node.\n\nHe also pointed out some optimizations to allow reusing hash codes that\nmight be cached in the node. The _M_src_hash_code function already has\nthe right logic to decide when a cached hash code can be reused by a\ndifferent _Hashtable object.\n\nlibstdc++-v3/ChangeLog:\n\n\t* include/bits/hashtable.h (_Hashtable::_M_src_hash_code):\n\tImprove comments.\n\t(_Hashtable::_M_merge_unique(_Hashtable&)): Use pointer_traits\n\tto get before-begin pointer. Only use static_cast on valid\n\tnodes, not the before-begin pointer. Reuse a hash code cached in\n\tthe node when possible.\n\t(_Hashtable::_M_merge_multi(_Hashtable&)): Likewise.\n---\n libstdc++-v3/include/bits/hashtable.h | 43 +++++++++++++++++----------\n 1 file changed, 27 insertions(+), 16 deletions(-)",
    "diff": "diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h\nindex 6a2da121ab98..a704816573ae 100644\n--- a/libstdc++-v3/include/bits/hashtable.h\n+++ b/libstdc++-v3/include/bits/hashtable.h\n@@ -1204,8 +1204,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \treturn { __n, this->_M_node_allocator() };\n       }\n \n-      // Only use the possibly cached node's hash code if its hash function\n-      // _H2 matches _Hash and is stateless. Otherwise recompute it using _Hash.\n+      // Hash code for node __src_n with key __k, using this->hash_function().\n+      // Will use a hash code cached in the node if safe to do so. This is\n+      // for use in _M_merge_multi where the node comes from another container\n+      // with a hash function that might not match this->hash_function().\n       template<typename _H2>\n \t__hash_code\n \t_M_src_hash_code(const _H2&, const key_type& __k,\n@@ -1213,6 +1215,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \t{\n \t  if constexpr (std::is_same_v<_H2, _Hash>)\n \t    if constexpr (std::is_empty_v<_Hash>)\n+\t      // If the node has a cached hash code, it's OK to use it.\n \t      return this->_M_hash_code(__src_n);\n \n \t  return this->_M_hash_code(__k);\n@@ -1246,28 +1249,31 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n       {\n \t__glibcxx_assert(get_allocator() == __src.get_allocator());\n \n+\tusing _PTr = pointer_traits<__node_base_ptr>;\n+\n \tauto __n_elt = __src.size();\n \tsize_type __first = 1;\n-\t// For a container of identical type we can use its private members.\n-\tauto __p = static_cast<__node_ptr>(&__src._M_before_begin);\n+\t// For a container of identical type we can use its private members,\n+\t// __src._M_before_begin, __src._M_bucket_index etc.\n+\tauto __prev = _PTr::pointer_to(__src._M_before_begin);\n \twhile (__n_elt--)\n \t  {\n-\t    const auto __prev = __p;\n-\t    __p = __p->_M_next();\n-\t    const auto& __node = *__p;\n+\t    const auto __next = __prev->_M_nxt;\n+\t    const auto& __node = static_cast<__node_type&>(*__next);\n \t    const key_type& __k = _ExtractKey{}(__node._M_v());\n-\t    auto __loc = _M_locate(__k);\n+\t    const auto __loc = _M_locate(__k);\n \t    if (__loc)\n-\t      continue;\n+\t      {\n+\t\t__prev = __next;\n+\t\tcontinue;\n+\t      }\n \n-\t    size_type __src_bkt\n-\t      = __src._M_bucket_index(__src.hash_function()(__k));\n+\t    auto __src_bkt = __src._M_bucket_index(__node);\n \t    auto __nh = __src._M_extract_node(__src_bkt, __prev);\n \t    _M_insert_unique_node(__loc._M_bucket_index, __loc._M_hash_code,\n \t\t\t\t  __nh._M_ptr, __first * __n_elt + 1);\n \t    __nh.release();\n \t    __first = 0;\n-\t    __p = __prev;\n \t  }\n       }\n \n@@ -1311,15 +1317,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \tif (__src.size() == 0) [[__unlikely__]]\n \t  return;\n \n+\tusing _PTr = pointer_traits<__node_base_ptr>;\n+\n \t__node_ptr __hint = nullptr;\n \tthis->reserve(size() + __src.size());\n-\t// For a container of identical type we can use its private members.\n-\tauto __prev = static_cast<__node_ptr>(&__src._M_before_begin);\n+\t// For a container of identical type we can use its private members,\n+\t// __src._M_before_begin, __src._M_bucket_index etc.\n+\tauto __prev = _PTr::pointer_to(__src._M_before_begin);\n \tdo\n \t  {\n-\t    const auto& __node = *__prev->_M_next();\n+\t    const auto& __node = static_cast<__node_type&>(*__prev->_M_nxt);\n \t    const key_type& __k = _ExtractKey{}(__node._M_v());\n-\t    __hash_code __code = this->_M_hash_code(__k);\n+\t    // Hash code from this->hash_function():\n+\t    auto __code = _M_src_hash_code(__src.hash_function(), __k, __node);\n+\t    // Bucket index in __src, using code from __src.hash_function():\n \t    size_type __src_bkt = __src._M_bucket_index(__node);\n \t    auto __nh = __src._M_extract_node(__src_bkt, __prev);\n \t    __hint = _M_insert_multi_node(__hint, __code, __nh._M_ptr)._M_cur;\n",
    "prefixes": [
        "v1",
        "1/1"
    ]
}