get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2194775,
    "url": "http://patchwork.ozlabs.org/api/patches/2194775/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/aYpONMU_ShpXrrCa@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": "<aYpONMU_ShpXrrCa@redhat.com>",
    "list_archive_url": null,
    "date": "2026-02-09T21:14:28",
    "name": "[v2] c++: fix for saved_token_sentinel",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "380333eb924d61f73418a079e847aed230579bd3",
    "submitter": {
        "id": 14370,
        "url": "http://patchwork.ozlabs.org/api/people/14370/?format=api",
        "name": "Marek Polacek",
        "email": "polacek@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/aYpONMU_ShpXrrCa@redhat.com/mbox/",
    "series": [
        {
            "id": 491570,
            "url": "http://patchwork.ozlabs.org/api/series/491570/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=491570",
            "date": "2026-02-09T21:14:28",
            "name": "[v2] c++: fix for saved_token_sentinel",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/491570/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2194775/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2194775/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=GRg2KzJZ;\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=GRg2KzJZ",
            "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.129.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 4f8yBy1pB8z1xtr\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 10 Feb 2026 08:15:06 +1100 (AEDT)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 25ABD4CF3132\n\tfor <incoming@patchwork.ozlabs.org>; Mon,  9 Feb 2026 21:15:04 +0000 (GMT)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by sourceware.org (Postfix) with ESMTP id DBCB84CF312A\n for <gcc-patches@gcc.gnu.org>; Mon,  9 Feb 2026 21:14:33 +0000 (GMT)",
            "from mail-qv1-f72.google.com (mail-qv1-f72.google.com\n [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-395-mo-rVcvTMa6KjIMvjipOwQ-1; Mon, 09 Feb 2026 16:14:32 -0500",
            "by mail-qv1-f72.google.com with SMTP id\n 6a1803df08f44-8966c2b187bso5672836d6.2\n for <gcc-patches@gcc.gnu.org>; Mon, 09 Feb 2026 13:14:32 -0800 (PST)",
            "from redhat.com ([2603:7000:9500:10::1db4])\n by smtp.gmail.com with ESMTPSA id\n 6a1803df08f44-896f79d34bcsm42871386d6.0.2026.02.09.13.14.29\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 09 Feb 2026 13:14:29 -0800 (PST)"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org 25ABD4CF3132",
            "OpenDKIM Filter v2.11.0 sourceware.org DBCB84CF312A"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org DBCB84CF312A",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org DBCB84CF312A",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1770671674; cv=none;\n b=ht12SQSW09s3j2Y+dT+Exy/4cQ/p11zln9ao6RNq+TkXY4RE+W5pYxxKO46BbIBF139AVPOxJfAuiFnoTVARonLnuMoDrMSw/gdsrvozsgJjXfj9346Nq/TsVK4b8w4ZyTSo2Mu3mB5b4DMTt22nkJDKC+0EwAWJab8O0FZoJqA=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1770671674; c=relaxed/simple;\n bh=aUDqjypvXhgEcAz80R5PJvAYam69zoY0z7HcXxVMVx4=;\n h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version;\n b=dPYTIBJZvjHfzhYQcwrA5a54EReDvVP+/6pFmgKlgiy1uAnCxmk3JJDurYq7RNjEMmhVuKct+79x12Art1mZqE1Rb7i4VlTiHIbLLmilwFihaPMKkdC2C0ngCm2ptQeGR2UG4AppAGlI7HpYlHdFQdbQXf8yz0IZcXwFQMh1YjA=",
        "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=1770671673;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n in-reply-to:in-reply-to:references:references;\n bh=uUUWRcr+iGy4K7JsU7HcYybES6Zuj9djxopZLWIjUzw=;\n b=GRg2KzJZqDpXhyipzJ+WvaQCG7djI76dhWvUpj7KqDtDPYinHgDs8/BCVoEa/VZz7dB+zV\n 30KN8wkUdSfOeVS4pPObGbaFmV0aHWXGLMOXOnp3ZfGpvDAJ2kyDFgzD6IVqtVjp0VrI2s\n 4TP9ksIyF6fKOIC80kjS7N1gTP8Ro38=",
        "X-MC-Unique": "mo-rVcvTMa6KjIMvjipOwQ-1",
        "X-Mimecast-MFC-AGG-ID": "mo-rVcvTMa6KjIMvjipOwQ_1770671671",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1770671671; x=1771276471;\n h=user-agent:in-reply-to:content-disposition:mime-version:references\n :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=uUUWRcr+iGy4K7JsU7HcYybES6Zuj9djxopZLWIjUzw=;\n b=vQ1d/H2aCfBXv2v7vpofNP/87ijnlsoCjRf7DduCurOtQ1C9oELNZ6h/WCLlmwuta3\n WnP83N+k16GeKCRnwILH8Z41gWs645SuBDzR9lVPqPw0rqlZSdDLLrTctXB+IzlHHYaR\n JXhT+rQrx7BtAasaxwC9fGdBu9gJlTLTGS9Y0XxYT0AzSmyl/BwrBGIELjErs9Xn65zL\n q34Zo1QqIlmVHIXMTuSXVHgf0Hyu/JneY51ZtgdrR0WQgoelcN8PmjbCGQIk6IF6AUDt\n t1bC1OsmcZWXZDBUIBVM6oc1+RoNzF263tBaJFICKzfxdKKOFVXzbSD5UszR2MRq8C6+\n ACrA==",
        "X-Gm-Message-State": "AOJu0YxkyBYik38wX3fndr/fVYPaPcXvniKTraKQ0jHFss1zE8sXCHcb\n NFMSBsrk2S5FqwgusAUfabRZbLLYNR7ihPvu5+vbZU/QCFqqbmJC+YyGYJY+GVSiIwJ90IWcjqz\n TjI+18xi0QsR0PSI10TbMl5pkl3z8dRK0brbChYYPNdld2kQ2rTJVKJ7ssile5tDvPTc=",
        "X-Gm-Gg": "AZuq6aIwz11omcYGA4ogHEb2M+ckCmVEvh11IMxJSEtfs3nWqQ4W7XlUMyxLG3mdx+9\n j88o6rceMkT+dO6xa/vS7JpTX+svlebKQ3mOKg+7gv9kD/PfKmxfHM9hsaNfkBfNkFsOfmI7Xbv\n hTKOh0EFQJobapR94InkyFWS5m66EW1y2lp21zDVZOuA75QMuTtRdFolzItW+wS+PdnyEuGPzZl\n n2Jbbs9cUPDj58tW0ZLMlHNOwhPma0lcDvOeQ6Qt9oi/o6pQEXgg8sm0rP6zgeeYJQg4ddc19QB\n zONLKxxPlzc1DPL+KWdi5gbouOmlQ0CpGEuF2WwAop8zoCg0HgeS2472dXchLE0ykg==",
        "X-Received": [
            "by 2002:a05:6214:130f:b0:88a:449e:81a6 with SMTP id\n 6a1803df08f44-8953ce99d9emr175328406d6.47.1770671670964;\n Mon, 09 Feb 2026 13:14:30 -0800 (PST)",
            "by 2002:a05:6214:130f:b0:88a:449e:81a6 with SMTP id\n 6a1803df08f44-8953ce99d9emr175328176d6.47.1770671670560;\n Mon, 09 Feb 2026 13:14:30 -0800 (PST)"
        ],
        "Date": "Mon, 9 Feb 2026 16:14:28 -0500",
        "From": "Marek Polacek <polacek@redhat.com>",
        "To": "Jason Merrill <jason@redhat.com>",
        "Cc": "GCC Patches <gcc-patches@gcc.gnu.org>",
        "Subject": "[PATCH v2] c++: fix for saved_token_sentinel",
        "Message-ID": "<aYpONMU_ShpXrrCa@redhat.com>",
        "References": "<20260121221728.976962-1-polacek@redhat.com>\n <87ff8c71-2663-4705-9e60-6df1b359f82d@redhat.com>\n <aXd_u6hoqfvqY5g5@redhat.com>\n <32b876d8-c3e6-4cd8-a8f1-577b0e543ca0@redhat.com>",
        "MIME-Version": "1.0",
        "In-Reply-To": "<32b876d8-c3e6-4cd8-a8f1-577b0e543ca0@redhat.com>",
        "User-Agent": "Mutt/2.2.14 (2025-02-20)",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-MFC-PROC-ID": "Al5Iu05YfU36Ke422hD5iJ2aEIPZEbM6F2bjc9TBOo4_1770671671",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Type": "text/plain; charset=us-ascii",
        "Content-Disposition": "inline",
        "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": "On Tue, Jan 27, 2026 at 10:31:26AM +0800, Jason Merrill wrote:\n> On 1/26/26 10:52 PM, Marek Polacek wrote:\n> > On Sat, Jan 24, 2026 at 05:25:06PM +0800, Jason Merrill wrote:\n> > > On 1/22/26 6:17 AM, Marek Polacek wrote:\n> > > > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?\n> > > > \n> > > > -- >8 --\n> > > > In cp_parser_splice_spec_is_nns_p I didn't use saved_token_sentinel:\n> > > > its rollback uses cp_lexer_previous_token so if we are the first token\n> > > > in the file, there are no previous tokens so we crash.\n> > > > \n> > > > It would be simple to just use the _safe variant of cp_lexer_previous_token\n> > > > and be done with this.  But that's not how this worked out: I saw a new\n> > > > -fcompare-debug FAIL with pr104025.C.  The problem is that at the end of\n> > > > cp_parser_id_expression we have a saved_token_sentinel guarded by\n> > > > warn_missing_template_keyword and in that spot lexer->buffer is NULL (so\n> > > > cp_lexer_set_source_position_from_token would be skipped).  pr104025.C\n> > > > is compiled twice, the second time with \"-w -fcompare-debug-second\".  So\n> > > > the first time we don't _set_source_position back to where we were after the\n> > > > _skip_entire_template_parameter_list (lexer->buffer is NULL) and the second\n> > > > time we don't get to the saved_token_sentinel at all.  That left us with\n> > > > different columns in the location:\n> > > > \n> > > >     \"pr104025.C\":16:16 vs \"pr104025.C\":16:12\n> > > > \n> > > > thus the -fcompare-debug FAIL.  I assume we don't want -fcompare-debug\n> > > > to ignore the column location.\n> > > \n> > > Agreed.\n> > > \n> > > > So this patch adds STS_ROLLBACK_SAFE to\n> > > > use the _safe variant of cp_lexer_previous_token.\n> > > \n> > > How about if safe_previous_token returns null then we use the current token\n> > > instead?  I'd rather not add separate modes.\n> > \n> > I also don't like adding a new mode.  But using the current token leads\n> > to the same -fcompare-debug FAIL with pr104025.C:\n> >     \"pr104025.C\":16:14 vs \"pr104025.C\":16:12\n> > \n> > As before, once we don't do saved_token_sentinel at all, and the second time\n> > we _set_source_position to something that doesn't match the previous position.\n> \n> Ah, so the problem is that _safe_previous_ is incompatible with\n> cp_lexer_new_from_tokens because the latter sets buffer to null. Perhaps\n> instead it should set it properly and the condition in cp_lexer_destroy\n> should check saved_type instead of buffer.\n> \n> Or we could just save input_location in saved_token_sentinel instead of\n> trying to recover it.\n\nNow that the splice parsing fixes are in, I'm coming back to this\nwith the latter point implemented:\n\nBootstrapped/regtested on ppc64le-pc-linux-gnu, ok for trunk?\n\n-- >8 --\nIn cp_parser_splice_spec_is_nns_p I didn't use saved_token_sentinel:\nits rollback uses cp_lexer_previous_token so if we are the first token\nin the file, there are no previous tokens so we crash.\n\nIt would be simple to just use the _safe variant of cp_lexer_previous_token\nand be done with this.  But that's not how this worked out: I saw a new\n-fcompare-debug FAIL with pr104025.C.  The problem is that at the end of\ncp_parser_id_expression we have a saved_token_sentinel guarded by\nwarn_missing_template_keyword and in that spot lexer->buffer is NULL (so\ncp_lexer_set_source_position_from_token would be skipped).  pr104025.C\nis compiled twice, the second time with \"-w -fcompare-debug-second\".  So\nthe first time we don't _set_source_position back to where we were after the\n_skip_entire_template_parameter_list (lexer->buffer is NULL) and the second\ntime we don't get to the saved_token_sentinel at all.  That left us with\ndifferent columns in the location:\n\n  \"pr104025.C\":16:16 vs \"pr104025.C\":16:12\n\nthus the -fcompare-debug FAIL.  I assume we don't want -fcompare-debug\nto ignore the column location.  So we could just save input_location in\nsaved_token_sentinel instead of trying to recover it.  And then\ncp_parser_splice_spec_is_nns_p can be simplified.\n\ngcc/cp/ChangeLog:\n\n\t* parser.cc (struct saved_token_sentinel): Save input_location.\n\t(saved_token_sentinel::rollback): Restore input_location.\n\t(cp_parser_splice_spec_is_nns_p): Use saved_token_sentinel.  Refactor.\n---\n gcc/cp/parser.cc | 21 ++++++---------------\n 1 file changed, 6 insertions(+), 15 deletions(-)\n\n\nbase-commit: fbf8cb97c5bcfd66936131b3cfe006b9878191ef",
    "diff": "diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc\nindex 986605e0cdc..8c46b260fff 100644\n--- a/gcc/cp/parser.cc\n+++ b/gcc/cp/parser.cc\n@@ -1635,10 +1635,11 @@ struct saved_token_sentinel\n {\n   cp_lexer *lexer;\n   unsigned len;\n+  location_t loc;\n   saved_token_sentinel_mode mode;\n   saved_token_sentinel (cp_lexer *_lexer,\n \t\t\tsaved_token_sentinel_mode _mode = STS_COMMIT)\n-    : lexer (_lexer), mode (_mode)\n+    : lexer (_lexer), loc (input_location), mode (_mode)\n   {\n     len = lexer->saved_tokens.length ();\n     cp_lexer_save_tokens (lexer);\n@@ -1646,8 +1647,7 @@ struct saved_token_sentinel\n   void rollback ()\n   {\n     cp_lexer_rollback_tokens (lexer);\n-    cp_lexer_set_source_position_from_token\n-      (cp_lexer_previous_token (lexer));\n+    input_location = loc;\n     mode = STS_DONOTHING;\n   }\n   ~saved_token_sentinel ()\n@@ -6523,18 +6523,9 @@ cp_parser_skip_entire_splice_expr (cp_parser *parser)\n static bool\n cp_parser_splice_spec_is_nns_p (cp_parser *parser)\n {\n-  /* ??? It'd be nice to use saved_token_sentinel, but its rollback\n-     uses cp_lexer_previous_token, but we may be the first token in the\n-     file so there are no previous tokens.  Sigh.  */\n-  cp_lexer_save_tokens (parser->lexer);\n-\n-  const bool ok = (cp_parser_skip_entire_splice_expr (parser)\n-\t\t   && cp_lexer_next_token_is (parser->lexer, CPP_SCOPE));\n-\n-  /* Roll back the tokens we skipped.  */\n-  cp_lexer_rollback_tokens (parser->lexer);\n-\n-  return ok;\n+  saved_token_sentinel toks (parser->lexer, STS_ROLLBACK);\n+  return (cp_parser_skip_entire_splice_expr (parser)\n+\t  && cp_lexer_next_token_is (parser->lexer, CPP_SCOPE));\n }\n \n /* Return true if the N-th token is '[:' and its closing ':]' is NOT\n",
    "prefixes": [
        "v2"
    ]
}