Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2226190/?format=api
{ "id": 2226190, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2226190/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/bmm.hhub6eebc2.gcc.gcc-TEST.redi.13.1.2@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.hhub6eebc2.gcc.gcc-TEST.redi.13.1.2@forge-stage.sourceware.org>", "date": "2026-04-22T10:23:07", "name": "[v1,2/2] libstdc++: More user-friendly failed assertions from shared_ptr dereference", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "f94f265437812b37afef756d203bf15a5d9117d8", "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.hhub6eebc2.gcc.gcc-TEST.redi.13.1.2@forge-stage.sourceware.org/mbox/", "series": [ { "id": 500968, "url": "http://patchwork.ozlabs.org/api/1.1/series/500968/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=500968", "date": "2026-04-22T10:23:05", "name": "Better assertions from filesystem directory iterators and shared_ptr", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/500968/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2226190/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2226190/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=38.145.34.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 [38.145.34.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 4g0wbF6frqz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 20:35:05 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id C4B4F436FA28\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 10:35:03 +0000 (GMT)", "from forge-stage.sourceware.org (vm08.sourceware.org [38.145.34.39])\n by sourceware.org (Postfix) with ESMTPS id 051794BB58B6\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 10:23:58 +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 D566240575\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 10:23:57 +0000 (UTC)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org C4B4F436FA28", "OpenDKIM Filter v2.11.0 sourceware.org 051794BB58B6" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 051794BB58B6", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 051794BB58B6", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776853438; cv=none;\n b=vydAu+kzxjLp7AfhB7Qg0O2k51q4zAeABxsOnaXI8aKYxNvIqVHjJzYCmLE5cZryagPNzpSGjdXfKkLgNMmimHLbd3XWD1hxmMAYiFAoD0dinOrGAPN+8y63b2VyEWhZ39MPwu06zJ1zFpPyfc9PP8sje/NW0m/JVrpXCAW9inE=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776853438; c=relaxed/simple;\n bh=LAhow6ziPYf52Brup/sJVDFDwD46OEoKw8uTVLnnUfw=;\n h=From:Date:Subject:To:Message-ID;\n b=G6d22C5XM8fVzPX5x4W1HriXI+X4lBnZTpiOeq/78lvfvPpsm4hOVAsYBYDPV794NKRA0q1faLpmpP2P0tkNyTWrgKpxCJ7Xuqo1UyBrZZmJ+9Tuqxby2adr17rJd4eTXCx7f7InIz0tbDD/YuZUm7GxVMmUbgsDixGS9irvpvM=", "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:23:07 +0000", "Subject": "[PATCH v1 2/2] libstdc++: More user-friendly failed assertions from\n shared_ptr dereference", "To": "gcc-patches mailing list <gcc-patches@gcc.gnu.org>", "Message-ID": "\n <bmm.hhub6eebc2.gcc.gcc-TEST.redi.13.1.2@forge-stage.sourceware.org>", "X-Mailer": "batrachomyomachia", "X-Pull-Request-Organization": "gcc", "X-Pull-Request-Repository": "gcc-TEST", "X-Pull-Request": "https://forge.sourceware.org/gcc/gcc-TEST/pulls/13", "References": "\n <bmm.hhub6eebc2.gcc.gcc-TEST.redi.13.1.0@forge-stage.sourceware.org>", "In-Reply-To": "\n <bmm.hhub6eebc2.gcc.gcc-TEST.redi.13.1.0@forge-stage.sourceware.org>", "X-Patch-URL": "\n https://forge.sourceware.org/redi/gcc/commit/4b66a15c10522168996049f2f7ec1392917bc82d", "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\nCurrently dereferencing an empty shared_ptr prints a complicated\ninternal type in the assertion message:\n\ninclude/bits/shared_ptr_base.h:1377: std::__shared_ptr_access<_Tp, _Lp, <anonymous>, <anonymous> >::element_type& std::__shared_ptr_access<_Tp, _Lp, <anonymous>, <anonymous> >::operator*() const [with _Tp = std::filesystem::__cxx11::recursive_directory_iterator::_Dir_stack; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic; bool <anonymous> = false; bool <anonymous> = false; element_type = std::filesystem::__cxx11::recursive_directory_iterator::_Dir_stack]: Assertion '_M_get() != nullptr' failed.\n\nUsers don't care about any of the _Lp and <anonymous> template\nparameters, so this is unnecessarily verbose.\n\nWe can simplify it to something that only mentions \"shared_ptr_deref\"\nand the element type:\n\ninclude/bits/shared_ptr_base.h:1371: _Tp* std::__shared_ptr_deref(_Tp*) [with _Tp = filesystem::__cxx11::recursive_directory_iterator::_Dir_stack]: Assertion '__p != nullptr' failed.\n\nlibstdc++-v3/ChangeLog:\n\n\t* include/bits/shared_ptr_base.h (__shared_ptr_deref): New\n\tfunction template.\n\t(__shared_ptr_access, __shared_ptr_access<>): Use it.\n---\n libstdc++-v3/include/bits/shared_ptr_base.h | 28 +++++++++++++--------\n 1 file changed, 17 insertions(+), 11 deletions(-)", "diff": "diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h\nindex 9a7617e7014f..ee01594ce0c5 100644\n--- a/libstdc++-v3/include/bits/shared_ptr_base.h\n+++ b/libstdc++-v3/include/bits/shared_ptr_base.h\n@@ -1337,6 +1337,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n { };\n \n \n+ template<typename _Tp>\n+ [[__gnu__::__always_inline__]]\n+ inline _Tp*\n+ __shared_ptr_deref(_Tp* __p)\n+ {\n+ __glibcxx_assert(__p != nullptr);\n+ return __p;\n+ }\n+\n // Define operator* and operator-> for shared_ptr<T>.\n template<typename _Tp, _Lock_policy _Lp,\n \t bool = is_array<_Tp>::value, bool = is_void<_Tp>::value>\n@@ -1347,10 +1356,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \n element_type&\n operator*() const noexcept\n- {\n-\t__glibcxx_assert(_M_get() != nullptr);\n-\treturn *_M_get();\n- }\n+ { return *std::__shared_ptr_deref(_M_get()); }\n \n element_type*\n operator->() const noexcept\n@@ -1392,10 +1398,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n [[__deprecated__(\"shared_ptr<T[]>::operator* is absent from C++17\")]]\n element_type&\n operator*() const noexcept\n- {\n-\t__glibcxx_assert(_M_get() != nullptr);\n-\treturn *_M_get();\n- }\n+ { return *std::__shared_ptr_deref(_M_get()); }\n \n [[__deprecated__(\"shared_ptr<T[]>::operator-> is absent from C++17\")]]\n element_type*\n@@ -1406,13 +1409,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n }\n #endif\n \n+#pragma GCC diagnostic push\n+#pragma GCC diagnostic ignored \"-Wc++17-extensions\"\n element_type&\n operator[](ptrdiff_t __i) const noexcept\n {\n-\t__glibcxx_assert(_M_get() != nullptr);\n-\t__glibcxx_assert(!extent<_Tp>::value || __i < extent<_Tp>::value);\n-\treturn _M_get()[__i];\n+\tif constexpr (extent<_Tp>::value)\n+\t __glibcxx_assert(__i < extent<_Tp>::value);\n+\treturn std::__shared_ptr_deref(_M_get())[__i];\n }\n+#pragma GCC diagnostic pop\n \n private:\n element_type*\n", "prefixes": [ "v1", "2/2" ] }