get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2218236,
    "url": "http://patchwork.ozlabs.org/api/patches/2218236/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260331182118.120657-1-konstantinos.eleftheriou@vrull.eu/",
    "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": "<20260331182118.120657-1-konstantinos.eleftheriou@vrull.eu>",
    "list_archive_url": null,
    "date": "2026-03-31T18:21:18",
    "name": "avoid-store-forwarding: Re-apply extension after bit insert sequence [PR124713]",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "f1fc9a068b5b8c78aa17a02132f6e71d030f1670",
    "submitter": {
        "id": 89121,
        "url": "http://patchwork.ozlabs.org/api/people/89121/?format=api",
        "name": "Konstantinos Eleftheriou",
        "email": "konstantinos.eleftheriou@vrull.eu"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260331182118.120657-1-konstantinos.eleftheriou@vrull.eu/mbox/",
    "series": [
        {
            "id": 498239,
            "url": "http://patchwork.ozlabs.org/api/series/498239/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=498239",
            "date": "2026-03-31T18:21:18",
            "name": "avoid-store-forwarding: Re-apply extension after bit insert sequence [PR124713]",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/498239/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2218236/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2218236/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 (2048-bit key;\n unprotected) header.d=vrull.eu header.i=@vrull.eu header.a=rsa-sha256\n header.s=google header.b=p4NeBZFk;\n\tdkim-atps=neutral",
            "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;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=vrull.eu header.i=@vrull.eu header.a=rsa-sha256\n header.s=google header.b=p4NeBZFk",
            "sourceware.org;\n dmarc=none (p=none dis=none) header.from=vrull.eu",
            "sourceware.org; spf=pass smtp.mailfrom=vrull.eu",
            "server2.sourceware.org;\n arc=none smtp.remote-ip=209.85.128.45"
        ],
        "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 4flcGW0pbsz1y1q\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 01 Apr 2026 05:34:24 +1100 (AEDT)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 07AD64B7A1F8\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 18:34:22 +0000 (GMT)",
            "from mail-wm1-f45.google.com (mail-wm1-f45.google.com\n [209.85.128.45])\n by sourceware.org (Postfix) with ESMTPS id 437DC4B9DB41\n for <gcc-patches@gcc.gnu.org>; Tue, 31 Mar 2026 18:33:52 +0000 (GMT)",
            "by mail-wm1-f45.google.com with SMTP id\n 5b1f17b1804b1-486fd27754bso59089735e9.3\n for <gcc-patches@gcc.gnu.org>; Tue, 31 Mar 2026 11:33:52 -0700 (PDT)",
            "from altra1.sec.univie.ac.at (altra1.sec.univie.ac.at.\n [131.130.126.103]) by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-4887e884dacsm78173695e9.15.2026.03.31.11.33.50\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 31 Mar 2026 11:33:50 -0700 (PDT)"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org 07AD64B7A1F8",
            "OpenDKIM Filter v2.11.0 sourceware.org 437DC4B9DB41"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 437DC4B9DB41",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 437DC4B9DB41",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774982032; cv=none;\n b=PmkwUbCHw+uTN5JaNt6x7jFIBSg16g8QOoCf0T7Zqj8Lmrj3OLIijIv1mzcZPMiHf5TuLbyebmHvfvjuxgU5KiKjDjrYeJnBIn8Ct1A10XOLqwS9CO3tPGfaM10xdIOPP+PYDH6HRyNK2JYrwmSBsAB+gBjlSVmwpK8D7dL6R9Y=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1774982032; c=relaxed/simple;\n bh=gsClKuqgJdi9tQhgrDwKfXRqsSRgb+2nwCyOh4NYKTc=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=Cg+ggp3ugCYWTXkYt5Tzz+4MBrats04hYUS8VNksP88IFa6G+g8iWMXrYSpzAxd1BKiquQcS6yUzJx1/V43PiFdVheZe/baZ4k0yDvKq+sR14e8gFTPRaW+YlsWkFqqU3kl1NCM/GLS+MiIMDFpbQQjej9kIlJ26NLsTs78M78M=",
        "ARC-Authentication-Results": "i=1; server2.sourceware.org",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=vrull.eu; s=google; t=1774982031; x=1775586831; darn=gcc.gnu.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=2l6DMPJFbq4byh2OljkH/EwnAQitbEAa2uughEpsWS8=;\n b=p4NeBZFkZcWbxifaxVAfRgcpiifdtjtxxeuaYAWq6mH/+TtPlHpxR6a6TujTHIIn72\n 8lryQnBDduAILP+LB67KW8CffentLr+c9Zo/tuu/TS00HYXgHGuukiifzkA4bVywDTvC\n 4hWtRDdzilecge5iQbvUEc1x7tBp3Aifem2TO0jaXv78Q6O/2moKLtD/Q8fDenazuopL\n +ieWzGmM+cFltZd5+20y7/QCVj4qWco3/BnSW8EtCl+JjqCRfvbHgXeyScS1HqMlDSzg\n rhkELeVUmbYGBiFfPPSgKSxCTXMFKC1UJM0Z2G6aDI6idWDvP7QSaZR04Yi5A40qqKho\n ChWQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774982031; x=1775586831;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=2l6DMPJFbq4byh2OljkH/EwnAQitbEAa2uughEpsWS8=;\n b=Ynmp1U705idRCqoqt5OoJeBYOTgkyE18ZAZCHc2qTLENPq8D6LkZjvCdda2Ap95hKG\n L/Zwq8ExhGkrR2pkeFrpV9tnltM/1EaqBDKpvFOOKD1/Nf2bBZnW2VUwErOp4STuStGM\n kIDLwP9Fwvkp9x4Q5NnQ+dRnAfPPkjUGkK4EeT001PJzkqEeoLNBSrH3SFVEzjZ/xLdr\n fOQsYO72CfMiEJPJj8E7dlppFFRDZXhWjuHobC55P6F+Tua5WcO24nu9mG3va/1wmOoy\n Xk3kHnpz1dAaNwUUPP0wk5eMIxGF3rU55uJs/AVBBPxjik5AJqCWn4TUZ1mHF0nYGpkg\n 63Uw==",
        "X-Gm-Message-State": "AOJu0YyiYiitPNJAYLE6MwSk8fw87O5dT74dWM0XHSVigSnkL+fd1fdQ\n KxKenlrnTE1ZGe/hspQDzbGgk5syPghIr8clgN+WiiLLMv3/VZ+qaqijbhg0CHxQSrrvaiudSHK\n pxIlI8no=",
        "X-Gm-Gg": "ATEYQzyDG1vLL9lZa9CKp+y9n6a0U7yord8mEAeK3WhcwIsJA46B9PoGKvfmmoMe47N\n mdg5bgFErb8eFgR/mHWGzRcudgBrMODNnTzc1VwhmWro3g9lHNQ+qszzIgFDpkgtBN2iXuC9idS\n Uk8FS04iKyCuFjOGSEvVofzWHeYo1NsDxNVv8Zan9K1ledOECYT8P33guKu9b0WSY0UwlXVukCV\n BDUYFj6pxFbY3UB/2vgrVkwiaxT2GbclwzGLd3Udtj0/x418rjl0YPAN1P4aaW/mrcbA7F3p2Zk\n KjEYcilK2YnbzxfZ2ICmCReZHFhcundGl09YM3Rjnil/axaEYjAR1QWH1SRIPn+fR54OGIEcaO1\n bvz/526wCB/Hhl2OwuecLrpe+wCJT3rGiVdCCV0AiMeZFU2dD4XPJeJIHmj6YeJrAnGjChUmRax\n f3z1sfjcMXL/WEU3wCk5rI7E80vo1eBAvLUh5cOFfDm0YHm6JJmwwkNVRujkof2mkbPXGSeficc\n CHk/sWnQA==",
        "X-Received": "by 2002:a05:600c:46d3:b0:487:1114:d42f with SMTP id\n 5b1f17b1804b1-4888355e812mr8261815e9.1.1774982030843;\n Tue, 31 Mar 2026 11:33:50 -0700 (PDT)",
        "From": "Konstantinos Eleftheriou <konstantinos.eleftheriou@vrull.eu>",
        "To": "gcc-patches@gcc.gnu.org",
        "Cc": "Philipp Tomsich <philipp.tomsich@vrull.eu>,\n Konstantinos Eleftheriou <konstantinos.eleftheriou@vrull.eu>",
        "Subject": "[PATCH] avoid-store-forwarding: Re-apply extension after bit insert\n sequence [PR124713]",
        "Date": "Tue, 31 Mar 2026 11:21:18 -0700",
        "Message-ID": "<20260331182118.120657-1-konstantinos.eleftheriou@vrull.eu>",
        "X-Mailer": "git-send-email 2.52.0",
        "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": "The avoid-store-forwarding pass loses SIGN_EXTEND/ZERO_EXTEND\nsemantics when the forwarding target is an extending load that is\nnot fully eliminated.  The bit-field insert operates on the\nfull-width destination register, but does not re-apply the\nextension, leaving stale upper bits from the original load.\n\nFix by emitting the corresponding extension after the bit insert\nsequence for non-eliminated extending loads, mirroring what the\nload-elimination path already does.\n\n\tPR rtl-optimization/124713\n\ngcc/ChangeLog:\n\n\t* avoid-store-forwarding.cc (process_store_forwarding): Re-apply\n\tSIGN_EXTEND/ZERO_EXTEND after bit insert sequence when the load is\n\tnot eliminated.\n\ngcc/testsuite/ChangeLog:\n\n\t* gcc.target/aarch64/pr124713.c: New test.\n---\n gcc/avoid-store-forwarding.cc               | 30 +++++++++++++++------\n gcc/testsuite/gcc.target/aarch64/pr124713.c | 24 +++++++++++++++++\n 2 files changed, 46 insertions(+), 8 deletions(-)\n create mode 100644 gcc/testsuite/gcc.target/aarch64/pr124713.c",
    "diff": "diff --git a/gcc/avoid-store-forwarding.cc b/gcc/avoid-store-forwarding.cc\nindex 260c135c219f..65be6f1398de 100644\n--- a/gcc/avoid-store-forwarding.cc\n+++ b/gcc/avoid-store-forwarding.cc\n@@ -355,20 +355,34 @@ process_store_forwarding (vec<store_fwd_info> &stores, rtx_insn *load_insn,\n       stores.ordered_remove (move_to_front);\n     }\n \n-  if (load_elim)\n+  machine_mode outer_mode = GET_MODE (SET_DEST (load));\n+  if (load_elim || outer_mode != load_mem_mode)\n     {\n-      machine_mode outer_mode = GET_MODE (SET_DEST (load));\n-      rtx load_move;\n-      rtx load_value = dest;\n+      /* If the load is being eliminated, emit a move (with extension if\n+\t needed) from the temp register to the original load destination.\n+\t Otherwise, if the load has SIGN_EXTEND or ZERO_EXTEND wrapping\n+\t the MEM, the bit insert sequence may have modified bits that\n+\t affect the extension (e.g. the sign bit), so re-apply it.  */\n+      rtx move_src;\n       if (outer_mode != load_mem_mode)\n \t{\n-\t  load_value = simplify_gen_unary (GET_CODE (SET_SRC (load)),\n-\t\t\t\t\t   outer_mode, dest, load_mem_mode);\n+\t  rtx ext_op = dest;\n+\t  if (!load_elim)\n+\t    {\n+\t      ext_op = lowpart_subreg (load_mem_mode, dest, outer_mode);\n+\t      if (!ext_op)\n+\t\treturn false;\n+\t    }\n+\t  move_src = simplify_gen_unary (GET_CODE (SET_SRC (load)),\n+\t\t\t\t\t outer_mode, ext_op, load_mem_mode);\n \t}\n-      load_move = gen_rtx_SET (SET_DEST (load), load_value);\n+      else\n+\tmove_src = dest;\n+\n+      rtx move = gen_rtx_SET (SET_DEST (load), move_src);\n \n       start_sequence ();\n-      rtx_insn *insn = emit_insn (load_move);\n+      rtx_insn *insn = emit_insn (move);\n       rtx_insn *seq = end_sequence ();\n \n       if (recog_memoized (insn) < 0)\ndiff --git a/gcc/testsuite/gcc.target/aarch64/pr124713.c b/gcc/testsuite/gcc.target/aarch64/pr124713.c\nnew file mode 100644\nindex 000000000000..798cf1fa9583\n--- /dev/null\n+++ b/gcc/testsuite/gcc.target/aarch64/pr124713.c\n@@ -0,0 +1,24 @@\n+/* PR rtl-optimization/124713 */\n+/* { dg-do run } */\n+/* { dg-require-effective-target aarch64_little_endian } */\n+/* { dg-options \"-Og -favoid-store-forwarding -fwrapv\" } */\n+\n+int x;\n+long y;\n+\n+__attribute__((noipa)) long\n+foo (short m)\n+{\n+  short b = m * 13;\n+  __builtin_memset (1 + (char *) &b, x, 1);\n+  long c = *(long *) __builtin_memset (&y, x, 4);\n+  return c + b;\n+}\n+\n+int\n+main ()\n+{\n+  long x = foo (3840);\n+  if (x)\n+    __builtin_abort ();\n+}\n",
    "prefixes": []
}