Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2194785/?format=api
{ "id": 2194785, "url": "http://patchwork.ozlabs.org/api/patches/2194785/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260209225133.1541710-1-jwakely@redhat.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/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, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260209225133.1541710-1-jwakely@redhat.com>", "list_archive_url": null, "date": "2026-02-09T22:50:51", "name": "libstdc++: Fix incorrect noexcept on string::compare overloads [PR123991]", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "59317b945748a207e5652cac09e5ab1f45cb58ad", "submitter": { "id": 48004, "url": "http://patchwork.ozlabs.org/api/people/48004/?format=api", "name": "Jonathan Wakely", "email": "jwakely@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260209225133.1541710-1-jwakely@redhat.com/mbox/", "series": [ { "id": 491575, "url": "http://patchwork.ozlabs.org/api/series/491575/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=491575", "date": "2026-02-09T22:50:51", "name": "libstdc++: Fix incorrect noexcept on string::compare overloads [PR123991]", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/491575/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2194785/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2194785/checks/", "tags": {}, "related": [], "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\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=PKkgf56D;\n\tdkim-atps=neutral", "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;\n\tdkim=pass (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=PKkgf56D", "sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com", "sourceware.org; spf=pass smtp.mailfrom=redhat.com", "server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.133.124" ], "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 4f90Mv3SrWz1xvb\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 10 Feb 2026 09:52:58 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 26AE948FDEDD\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 9 Feb 2026 22:52:56 +0000 (GMT)", "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by sourceware.org (Postfix) with ESMTP id B79C348FE09E\n for <gcc-patches@gcc.gnu.org>; Mon, 9 Feb 2026 22:51:40 +0000 (GMT)", "from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-68-q4B5Q24HMLik_s8eWVweeQ-1; Mon,\n 09 Feb 2026 17:51:37 -0500", "from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 4C90919560B0; Mon, 9 Feb 2026 22:51:36 +0000 (UTC)", "from zen.kayari.org (unknown [10.45.226.222])\n by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 3AF1B1956056; Mon, 9 Feb 2026 22:51:34 +0000 (UTC)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 26AE948FDEDD", "OpenDKIM Filter v2.11.0 sourceware.org B79C348FE09E" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org B79C348FE09E", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org B79C348FE09E", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1770677500; cv=none;\n b=wYRv8wmK+EaFCiMp0GATk2dcs8m573bPwGmkcD26ptAdFrruFwAWXA2D10BtekpvlYDJgoQCxHgkyigHhX61Zre97aGsOHCk1D7EDjhiMiy4Z2zWvtACjpGwzicSGf+EXXFLh5Euo8z65/HSyc0HWJ9SICUoffLxKyU5Hsk2Ykw=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1770677500; c=relaxed/simple;\n bh=j6rBX/8ftiOULLTxVMcWezLkCIYSRZurw7gz7sYc++s=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=SAj1RG6TzpUF09p6mPdkCxnz5UhCkxVwyUe9AldFM/MWghknox2HkfhW41VeL6vnhqOFZTCDFEazfZkcaq0siBeMmvw5lK4BEr4wqpybEqtOfhIkuGEa4PvQmqVnr5EmP0/GGY01TZLVrxVQj7mS/4saXd1rQM7eJcymRLP5Wis=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1770677500;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=zsQvcAJzCzCx/qf58QybPA2nwUzFPuuicGpCec9LX/Y=;\n b=PKkgf56Dk0bKMeQNOXYuHr6b7/Lu5+Qz62IpT7aFo7B+5go/2PgazWDiU43U0BmdcUdwIR\n fp/dGp5xpS4PwIOcKr8ko62IlCP5Xhs/yZpgDMc5HmO6iCf3PgorCVDTUAC2MMP2OSEjmM\n y5gRjg3oJN+N/OiPGSJbo/CmTS9bP7k=", "X-MC-Unique": "q4B5Q24HMLik_s8eWVweeQ-1", "X-Mimecast-MFC-AGG-ID": "q4B5Q24HMLik_s8eWVweeQ_1770677496", "From": "Jonathan Wakely <jwakely@redhat.com>", "To": "gcc-patches@gcc.gnu.org,\n\tlibstdc++@gcc.gnu.org", "Subject": "[PATCH] libstdc++: Fix incorrect noexcept on string::compare\n overloads [PR123991]", "Date": "Mon, 9 Feb 2026 22:50:51 +0000", "Message-ID": "<20260209225133.1541710-1-jwakely@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.17", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "3OwMRW9OsZAPMaO7sjmF6FZ6xt9TCjjaVixzMZ1JhlQ_1770677496", "X-Mimecast-Originator": "redhat.com", "Content-Type": "text/plain", "Content-Transfer-Encoding": "8bit", "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>", "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org" }, "content": "These compare overloads throw when the pos index is out of range, not\nonly when the const T& parameter throws on conversion to string_view.\n\nRemove the incorrect conditional noexcept-specifier from the two\noverloads that can throw.\n\nlibstdc++-v3/ChangeLog:\n\n\tPR libstdc++/123991\n\t* include/bits/basic_string.h (compare(size_type, size_type, T)):\n\tRemove noexcept-specifier.\n\t(compare(size_type, size_type, T, size_type, size_type)):\n\tLikewise.\n\t* include/bits/cow_string.h (compare(size_type, size_type, T)):\n Remove noexcept-specifier.\n (compare(size_type, size_type, T, size_type, size_type)):\n Likewise.\n\t* testsuite/21_strings/basic_string/operations/compare/char/123991.cc:\n\tNew test.\n\t* testsuite/21_strings/basic_string/operations/compare/wchar_t/123991.cc:\n\tNew test.\n---\n\nTested x86_64-linux.\n\nThis is a regression, so backports are needed to all branches.\n\n libstdc++-v3/include/bits/basic_string.h | 2 -\n libstdc++-v3/include/bits/cow_string.h | 2 -\n .../operations/compare/char/123991.cc | 56 +++++++++++++++++++\n .../operations/compare/wchar_t/123991.cc | 56 +++++++++++++++++++\n 4 files changed, 112 insertions(+), 4 deletions(-)\n create mode 100644 libstdc++-v3/testsuite/21_strings/basic_string/operations/compare/char/123991.cc\n create mode 100644 libstdc++-v3/testsuite/21_strings/basic_string/operations/compare/wchar_t/123991.cc", "diff": "diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h\nindex 0602b0dcac88..cd6f312f1bd2 100644\n--- a/libstdc++-v3/include/bits/basic_string.h\n+++ b/libstdc++-v3/include/bits/basic_string.h\n@@ -3524,7 +3524,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11\n \t_GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR\n \t_If_sv<_Tp, int>\n \tcompare(size_type __pos, size_type __n, const _Tp& __svt) const\n-\tnoexcept(is_same<_Tp, __sv_type>::value)\n \t{\n \t __sv_type __sv = __svt;\n \t return __sv_type(*this).substr(__pos, __n).compare(__sv);\n@@ -3545,7 +3544,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11\n \t_If_sv<_Tp, int>\n \tcompare(size_type __pos1, size_type __n1, const _Tp& __svt,\n \t\tsize_type __pos2, size_type __n2 = npos) const\n-\tnoexcept(is_same<_Tp, __sv_type>::value)\n \t{\n \t __sv_type __sv = __svt;\n \t return __sv_type(*this)\ndiff --git a/libstdc++-v3/include/bits/cow_string.h b/libstdc++-v3/include/bits/cow_string.h\nindex 36c19fabfc5b..6cf002243729 100644\n--- a/libstdc++-v3/include/bits/cow_string.h\n+++ b/libstdc++-v3/include/bits/cow_string.h\n@@ -2998,7 +2998,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n template<typename _Tp>\n \t_If_sv<_Tp, int>\n \tcompare(size_type __pos, size_type __n, const _Tp& __svt) const\n-\tnoexcept(is_same<_Tp, __sv_type>::value)\n \t{\n \t __sv_type __sv = __svt;\n \t return __sv_type(*this).substr(__pos, __n).compare(__sv);\n@@ -3018,7 +3017,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \t_If_sv<_Tp, int>\n \tcompare(size_type __pos1, size_type __n1, const _Tp& __svt,\n \t\tsize_type __pos2, size_type __n2 = npos) const\n-\tnoexcept(is_same<_Tp, __sv_type>::value)\n \t{\n \t __sv_type __sv = __svt;\n \t return __sv_type(*this)\ndiff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operations/compare/char/123991.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operations/compare/char/123991.cc\nnew file mode 100644\nindex 000000000000..53ef2d4606c6\n--- /dev/null\n+++ b/libstdc++-v3/testsuite/21_strings/basic_string/operations/compare/char/123991.cc\n@@ -0,0 +1,56 @@\n+// { dg-do run { target c++17 } }\n+\n+// Bug 123991 - std::string::compare crashes instead of throwing\n+\n+#include <string>\n+#include <string_view>\n+#include <stdexcept>\n+#include <testsuite_hooks.h>\n+\n+void\n+test_compare_3arg()\n+{\n+ std::string_view sv;\n+ std::string s;\n+ static_assert( ! noexcept(s.compare(0, 0, sv)) );\n+#ifdef __cpp_exceptions\n+ try\n+ {\n+ (void) s.compare(1, 0, sv);\n+ VERIFY(false);\n+ }\n+ catch (const std::out_of_range&)\n+ { }\n+#endif\n+}\n+\n+void\n+test_compare_5arg()\n+{\n+ std::string_view sv;\n+ std::string s;\n+ static_assert( ! noexcept(s.compare(0, 0, sv, 0, 0)) );\n+#ifdef __cpp_exceptions\n+ try\n+ {\n+ (void) s.compare(1, 0, sv, 0, 0);\n+ VERIFY(false);\n+ }\n+ catch (const std::out_of_range&)\n+ { }\n+\n+ try\n+ {\n+ (void) s.compare(0, 0, sv, 1, 0);\n+ VERIFY(false);\n+ }\n+ catch (const std::out_of_range&)\n+ { }\n+#endif\n+}\n+\n+int main()\n+{\n+ test_compare_3arg();\n+ test_compare_5arg();\n+}\ndiff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operations/compare/wchar_t/123991.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operations/compare/wchar_t/123991.cc\nnew file mode 100644\nindex 000000000000..c4188bbff8b2\n--- /dev/null\n+++ b/libstdc++-v3/testsuite/21_strings/basic_string/operations/compare/wchar_t/123991.cc\n@@ -0,0 +1,56 @@\n+// { dg-do run { target c++17 } }\n+\n+// Bug 123991 - std::string::compare crashes instead of throwing\n+\n+#include <string>\n+#include <string_view>\n+#include <stdexcept>\n+#include <testsuite_hooks.h>\n+\n+void\n+test_compare_3arg()\n+{\n+ std::wstring_view sv;\n+ std::wstring s;\n+ static_assert( ! noexcept(s.compare(0, 0, sv)) );\n+#ifdef __cpp_exceptions\n+ try\n+ {\n+ (void) s.compare(1, 0, sv);\n+ VERIFY(false);\n+ }\n+ catch (const std::out_of_range&)\n+ { }\n+#endif\n+}\n+\n+void\n+test_compare_5arg()\n+{\n+ std::wstring_view sv;\n+ std::wstring s;\n+ static_assert( ! noexcept(s.compare(0, 0, sv, 0, 0)) );\n+#ifdef __cpp_exceptions\n+ try\n+ {\n+ (void) s.compare(1, 0, sv, 0, 0);\n+ VERIFY(false);\n+ }\n+ catch (const std::out_of_range&)\n+ { }\n+\n+ try\n+ {\n+ (void) s.compare(0, 0, sv, 1, 0);\n+ VERIFY(false);\n+ }\n+ catch (const std::out_of_range&)\n+ { }\n+#endif\n+}\n+\n+int main()\n+{\n+ test_compare_3arg();\n+ test_compare_5arg();\n+}\n", "prefixes": [] }