get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2230497,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2230497/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/tencent_6643D30414E51F9CE20CC76E6C2C65AB3D05@qq.com/",
    "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": "<tencent_6643D30414E51F9CE20CC76E6C2C65AB3D05@qq.com>",
    "date": "2026-04-29T19:22:49",
    "name": "[v5] c++, contracts: fix testsuite basic.contract.eval.p8 failed",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "bf3440b2f66edf7e7c27accbe0a24b9568d180e0",
    "submitter": {
        "id": 89506,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/89506/?format=api",
        "name": "yxj-github-437",
        "email": "2457369732@qq.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/tencent_6643D30414E51F9CE20CC76E6C2C65AB3D05@qq.com/mbox/",
    "series": [
        {
            "id": 502139,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/502139/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=502139",
            "date": "2026-04-29T19:22:49",
            "name": "[v5] c++, contracts: fix testsuite basic.contract.eval.p8 failed",
            "version": 5,
            "mbox": "http://patchwork.ozlabs.org/series/502139/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2230497/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2230497/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\tdkim=pass (1024-bit key;\n unprotected) header.d=qq.com header.i=@qq.com header.a=rsa-sha256\n header.s=s201512 header.b=H+Ndphtf;\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=qq.com header.i=@qq.com header.a=rsa-sha256\n header.s=s201512 header.b=H+Ndphtf",
            "sourceware.org;\n dmarc=pass (p=quarantine dis=none) header.from=qq.com",
            "sourceware.org; spf=pass smtp.mailfrom=qq.com",
            "server2.sourceware.org;\n arc=none smtp.remote-ip=203.205.221.191"
        ],
        "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 4g5S2C0RXcz1yHZ\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 05:25:37 +1000 (AEST)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 4AEA14BBCDA3\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 19:25:35 +0000 (GMT)",
            "from out203-205-221-191.mail.qq.com (out203-205-221-191.mail.qq.com\n [203.205.221.191])\n by sourceware.org (Postfix) with UTF8SMTPS id C34A64B99F5D;\n Wed, 29 Apr 2026 19:24:57 +0000 (GMT)",
            "from localhost.localdomain ([123.139.164.214])\n by newxmesmtplogicsvrszb51-0.qq.com (NewEsmtp) with SMTP\n id 6330D287; Thu, 30 Apr 2026 03:24:51 +0800"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org 4AEA14BBCDA3",
            "OpenDKIM Filter v2.11.0 sourceware.org C34A64B99F5D"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org C34A64B99F5D",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org C34A64B99F5D",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777490698; cv=none;\n b=ou3V0Z9S9+V2x7I+zfiag+y3eQaOT8O2BkF6FUTDauTXbo8AEcEn8fx2ezQDoNPBNrR9KU/pLTHGeuEzKfYR5ebBeeoDvzi6lENDM+EFJ7qGrl5ONUjCy3v73hEALKmiTGOPSfjJZElXSGxtj4cZTUmpDSHqcqxQpPye/q52fN8=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777490698; c=relaxed/simple;\n bh=RX37YjUW44WcUXBMDFjUjRE+NQdr/l12g2a/oFVFkus=;\n h=DKIM-Signature:Message-ID:From:To:Subject:Date:MIME-Version;\n b=m3bVi12Yn+b5bvbBFgbqEOwvhSjuk4yJ3mHp+M15Er8h7jGxxFWp3STd11urbbVFWBMl6323oEX7XUiH4zj0GwjBHVZlRX5yJqF+56cUfUvO7ijL8I/kZYK6u+TatdNx22IjJJwmzSTaqWmUTz8Blw48mb++AZwz8zK05S4CTCE=",
        "ARC-Authentication-Results": "i=1; server2.sourceware.org",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512;\n t=1777490693; bh=KWUOXCs+SUnSt8z4ACVlYt2r1f62uu+6ZjwZNgtKEhc=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References;\n b=H+Ndphtf3+NFvsLeaeJYHg9ZXD3is793SI8Z4CDlRrDj4ac35S/xqTs8tH9OiK5IA\n aUodf7xY9D8O97qKcRp1xYTPC5HJgB8Cst4gNoyRvkU6Mgg2UWYynNPBBeCCYaDdVS\n nUL3HNBe9VZucAA+t8BgasiECijS05tOYaFYtXsM=",
        "X-QQ-mid": "xmsmtpt1777490691th4yvuorn",
        "Message-ID": "<tencent_6643D30414E51F9CE20CC76E6C2C65AB3D05@qq.com>",
        "X-QQ-XMAILINFO": "NVQMfSTXSDo/YBN+Rb6CJtgDJ9o4m+0L6j4ivlaZWjzrOjoh3noe0XENlr5dKv\n ZhVPsq4UWVQ3CZU0QG/c2zgLA5k6UlqizcvtI9Oy27UKpNUT/J7DnUIIfUiCigR2Z+8HGwbd1b7B\n AFVzz0m2A7NKuDcJ3o+yIRAmeDKrfSJeKxbjuq0KyibxBfCddLrM+NBJtEEGYkjE7ZJQBre2WilD\n v6LPqFTUBSh40LvNsuwNuMAU0UkQ6akopO4iMho1nFVGA4RPmRzDtIv3NLv+7gMs9GK57uhV9K7O\n nBpg7EX7uAGJoetoqS5HUKQNcxdjH/9NPQQMErZN5WWqb3V7LU0I8/EYdp0cTvN/CSXRct68MlNz\n /pZDVt0wovWlCq4cXGQxwMhkJskBeh4FAfIpJMMmfmyP9yculpoF2Bg+Nn4m//znZoTbOH+z7POa\n r203D0ljue+uK6PJRnETcaF1VkSNiPTQn2GD+guvprTyEB9UDXOCDH4khnXvTzW+HjPTmEm4+iez\n FzRFLn6KEn2S1KLhgAo/h6630v4oeB42CERyjWnnSSAXj4ryPMPId1b/HBO1oSJRsNHy6lgvpLn/\n gI9QWvzZvDab1uTeK5oy0Zj98+GvNe1pdGRJ37bIu8M+Tn+WSoahKU1fE4pAcD0fZuROuGHzshaL\n d0sYzL5NwJP9DQr+686KBwrd4wuocHFX7jCQX9zsUUojbgpmz1vHIRlywRR3gL7O9M9PGt6MLmBR\n hwBfpx8kOOHFtlL0lsjcWVhJWNr+XLADSSiTLxrDE0rNKAbz75D0H8pWJ4I76ouCNE7daTU+FvIq\n /iRc3UCeffBvWv7kdQUvqV2oJieZhVxLQHOQ8lZiQwxKkaY7z9ZXtF4dHxINliRz4HUMLwfavGc4\n 1XFa6eh8PmF5vV28ub5hGL2kN78Y3BsCFWPGZB6SlzLIPZQ1A5X6ckn0fOlT8OuQbwCwuuHeYksl\n 1klyR9AIAZWe4hUqsy/bCQG9Wpb02iwHa8tgkEJGyKJU1JU9WuzbuM8Ko2yYqTV7ayynhC6ppJjj\n yeO4j8pA==",
        "X-QQ-XMRINFO": "NI4Ajvh11aEjEMj13RCX7UuhPEoou2bs1g==",
        "From": "yxj-github-437 <2457369732@qq.com>",
        "To": "jason@redhat.com",
        "Cc": "gcc-patches@gcc.gnu.org, nathan@acm.org, ppalka@gcc.gnu.org,\n yxj-github-437 <2457369732@qq.com>",
        "Subject": "[PATCH v5] c++,\n contracts: fix testsuite basic.contract.eval.p8 failed",
        "Date": "Thu, 30 Apr 2026 03:22:49 +0800",
        "X-OQ-MSGID": "<20260429192249.72503-1-2457369732@qq.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<a49890f7-d8b9-4b40-bf35-de461b42fb3d@redhat.com>",
        "References": "<a49890f7-d8b9-4b40-bf35-de461b42fb3d@redhat.com>",
        "MIME-Version": "1.0",
        "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": ">>>> If in a context that is manifestly constant-evaluated ([expr.const]),\n>>>> a contract violation occurs and the evaluation semantic is terminating\n>>>> or contract stmt isnot constant-evaluated, the non_constant_p should be\n>>>> set true.\n>>>\n>>> Please add a testcase?  If this is supposed to improve the test in\n>>> [basic.contract.eval]/8, then I don't see how, since with this patch\n>>> we emit the error twice:\n>>>\n>>> q.C:3:3: error: contract condition is not constant\n>>>      3 |   contract_assert((++const_cast<int&>(i), true));\n>>>        |   ^~~~~~~~~~~~~~~\n>>> q.C:3:3: error: contract condition is not constant\n>>>\n>>> instead of just once as before.  That doesn't seem like an improvement.\n>>\n>> Yes, the patch was wrong.The reason for the test case failure may be that\n>> constexpr_call did not cache contract violation information.\n>> The new patch as following.\n>>\n>> ----------------8<-----------------\n>>\n>> I noticed that the following code passed.\n>>\n>> 1 | consteval void foo( auto x ) pre( false ) { return x; }\n>> 2 |\n>> 3 | static_assert (foo( 1 ) == 1, \"\");\n>> 4 |\n>> 5 | int main() {\n>> 6 |   foo( 1 );\n>> 7 | }\n>>\n>> However, the code has a contract violation.\n>> In constexpr_call, the result will be cached, but not cache the\n>> existence of contract violations.\n>>\n>> gcc/cp/ChangeLog:\n>>  * constexpr.cc (cxx_eval_constant_expression): cache failed or\n>>  no constant contract statement\n>\n> I think it would be simpler to set cacheable to false if there are\n> contract violations.\n\nIt's great! The change is very small.\nAnd I notice that:\n\nbasic.contract.eval.p8.C: In function 'int main()':\nbasic.contract.eval.p8.C:8:30: error: contract predicate is false in constant expression\n    8 | consteval void foo( auto x ) pre( false ) {}\n      |                              ^~~~~~~~~~~~\nbasic.contract.eval.p8.C:11:6: error: call to consteval function 'foo<int>(42)' is not a constant expression\n   11 |   foo( 42 ); // { dg-error {call to consteval function 'foo<int>\\(42\\)' is not a constant expression} }\n      |   ~~~^~~~~~\nbasic.contract.eval.p8.C:8:30: error: contract predicate is false in constant expression\n    8 | consteval void foo( auto x ) pre( false ) {}\n      |                              ^~~~~~~~~~~~\n\nThe error report abort contract violations appeared twice. It's expected?\nIf it only needs to be reported once, consider adding the following code in the function `check_for_failed_contracts`.\n\n  if (!ctx->quiet)\n    return error;\n\nHow abort it?\n\n----------------8<-----------------\n\nI noticed that the following code passed.\n\n1 | consteval void foo( auto x ) pre( false ) { return x; }\n2 |\n3 | static_assert (foo( 1 ) == 1, \"\");\n4 |\n5 | int main() {\n6 |   foo( 1 );\n7 | }\n\nHowever, the code has contract violations.\nIn constexpr_call, a result with contract violations should\nnot be cached.\n\ngcc/cp/ChangeLog:\n\t* constexpr.cc (cxx_eval_constant_expression): donot cache\n\tresult with contract violation.\ngcc/testsuite/ChangeLog:\n\t* g++.dg/contracts/cpp26/basic.contract.eval.p8-3.C: New\n---\n gcc/cp/constexpr.cc                               |  4 ++++\n .../contracts/cpp26/basic.contract.eval.p8-3.C    | 15 +++++++++++++++\n 2 files changed, 19 insertions(+)\n create mode 100644 gcc/testsuite/g++.dg/contracts/cpp26/basic.contract.eval.p8-3.C\n\n--\n2.43.0",
    "diff": "diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc\nindex a593b66dd41..efb7a42014b 100644\n--- a/gcc/cp/constexpr.cc\n+++ b/gcc/cp/constexpr.cc\n@@ -4639,6 +4639,10 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,\n \t  /* Only cache a permitted result of a constant expression.  */\n \t  if (cacheable && !reduced_constant_expression_p (result))\n \t    cacheable = false;\n+\n+\t  /* Only cache a result without contract violations */\n+\t  if (cacheable && ctx->global->contract_statement)\n+\t    cacheable = false;\n \t}\n       else\n \t/* Couldn't get a function copy to evaluate.  */\ndiff --git a/gcc/testsuite/g++.dg/contracts/cpp26/basic.contract.eval.p8-3.C b/gcc/testsuite/g++.dg/contracts/cpp26/basic.contract.eval.p8-3.C\nnew file mode 100644\nindex 00000000000..869d7dc35e6\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/contracts/cpp26/basic.contract.eval.p8-3.C\n@@ -0,0 +1,15 @@\n+// basic.contract.eval/p8\n+// If a contract violation occurs in a context that is manifestly\n+// constant-evaluated ([expr.const]), and the evaluation semantic is a\n+// terminating semantic, the program is ill-formed.\n+// { dg-do compile { target c++23 } }\n+// { dg-additional-options \"-fcontracts  \" }\n+\n+consteval auto foo( auto x ) pre( false ) { return x; }\n+// { dg-error {contract predicate is false in constant expression} \"\" { target *-*-* } .-1 }\n+\n+static_assert(foo( 42 ) == 42, \"\");\n+\n+int main() {\n+  foo( 42 ); // { dg-error {call to consteval function 'foo<int>\\(42\\)' is not a constant expression} }\n+}\n",
    "prefixes": [
        "v5"
    ]
}