get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2194149,
    "url": "http://patchwork.ozlabs.org/api/patches/2194149/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/ri6wm0pplbw.fsf@virgil.suse.cz/",
    "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": "<ri6wm0pplbw.fsf@virgil.suse.cz>",
    "list_archive_url": null,
    "date": "2026-02-06T22:18:43",
    "name": "tree-sra: Do not propagate bit-field accesses across assignments (PR 117217)",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "b8de354636a7e8b68612d403ce6434faffe59385",
    "submitter": {
        "id": 4351,
        "url": "http://patchwork.ozlabs.org/api/people/4351/?format=api",
        "name": "Martin Jambor",
        "email": "mjambor@suse.cz"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/ri6wm0pplbw.fsf@virgil.suse.cz/mbox/",
    "series": [
        {
            "id": 491345,
            "url": "http://patchwork.ozlabs.org/api/series/491345/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=491345",
            "date": "2026-02-06T22:18:43",
            "name": "tree-sra: Do not propagate bit-field accesses across assignments (PR 117217)",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/491345/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2194149/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2194149/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=suse.cz header.i=@suse.cz header.a=rsa-sha256\n header.s=susede2_rsa header.b=zm+X7fOc;\n\tdkim=pass header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=J7I0GIY6;\n\tdkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz\n header.a=rsa-sha256 header.s=susede2_rsa header.b=zm+X7fOc;\n\tdkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=J7I0GIY6;\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=suse.cz header.i=@suse.cz header.a=rsa-sha256\n header.s=susede2_rsa header.b=zm+X7fOc;\n\tdkim=pass header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=J7I0GIY6;\n\tdkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz\n header.a=rsa-sha256 header.s=susede2_rsa header.b=zm+X7fOc;\n\tdkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=J7I0GIY6",
            "sourceware.org;\n dmarc=none (p=none dis=none) header.from=suse.cz",
            "sourceware.org; spf=pass smtp.mailfrom=suse.cz",
            "server2.sourceware.org;\n arc=none smtp.remote-ip=195.135.223.131",
            "smtp-out2.suse.de;\n\tnone"
        ],
        "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 4f77mZ2cw5z1xvW\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 07 Feb 2026 09:19:26 +1100 (AEDT)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 4480A4BAD155\n\tfor <incoming@patchwork.ozlabs.org>; Fri,  6 Feb 2026 22:19:24 +0000 (GMT)",
            "from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131])\n by sourceware.org (Postfix) with ESMTPS id ADF3E4B9DB7F\n for <gcc-patches@gcc.gnu.org>; Fri,  6 Feb 2026 22:18:52 +0000 (GMT)",
            "from imap1.dmz-prg2.suse.org (unknown [10.150.64.97])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-out2.suse.de (Postfix) with ESMTPS id 94C255BCCF;\n Fri,  6 Feb 2026 22:18:51 +0000 (UTC)",
            "from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 80A8B3EA63;\n Fri,  6 Feb 2026 22:18:51 +0000 (UTC)",
            "from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])\n by imap1.dmz-prg2.suse.org with ESMTPSA id ZfRnH8tohmnhMwAAD6G6ig\n (envelope-from <mjambor@suse.cz>); Fri, 06 Feb 2026 22:18:51 +0000"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org 4480A4BAD155",
            "OpenDKIM Filter v2.11.0 sourceware.org ADF3E4B9DB7F"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org ADF3E4B9DB7F",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org ADF3E4B9DB7F",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1770416332; cv=none;\n b=jQl6qv409BWvgqFZJ3KO6Fhhl+HvenTQV1JPl3chd+KHbs8grY7HkJQexZ39aTEA1yOhkjf74WsXiOZvdSKIlK601uqoRRL8c5VFozFj7DKck9EoPmcMZJWdE8nOf/CxU7jr6QI5iUxKjc+LXUPvEZfzErTdI5aNYrqNzvEGE9s=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1770416332; c=relaxed/simple;\n bh=nX9+Aev0tqOLzHBIY6KD9xVGtTbRML+QkbfgtZCQSt8=;\n h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From:\n To:Subject:Date:Message-ID:MIME-Version;\n b=qWMl/2ivBnvIuoAzFXXvPoW264HTYESz9/IVlfiRgvANbNopYYcxIlLCzuB0CvY3+/EKHZSQhIr6IpFltgDUe53Ui25jxDSYhVUNCUSdvV1W/MfIdLDapkcicqN3/CpgsMPwLY/RwNY+b4jMNJUDU4orJIeKSSAp6e2WXp1mC+0=",
        "ARC-Authentication-Results": "i=1; server2.sourceware.org",
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz;\n s=susede2_rsa;\n t=1770416331;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type;\n bh=GrqNvN9Igw7C5M+fSnNqFeNwbMiIeBuEQ+QDuljmH4M=;\n b=zm+X7fOcMEPKusfOiSl4jl5wQoXa1Fi75TSZia19gIOlGc9vD5WcFdNld3rnO2xwCXHG2b\n Uvl4BVQ8/5DODpMtxx211cKTkWm8TYqJdpPBcVyMitAampac+FBxVN6THvtWEl4jf6EAgv\n an1mitBvFSKTwXxc4azXcZF02Q7V9tU=",
            "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz;\n s=susede2_ed25519; t=1770416331;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type;\n bh=GrqNvN9Igw7C5M+fSnNqFeNwbMiIeBuEQ+QDuljmH4M=;\n b=J7I0GIY6G5I165PxEteDH5G2i44spuWKy3IHlnDuj03l8anVMOXMluan2iffTivxiWXkCj\n +vMcusZJaX7FVADQ==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz;\n s=susede2_rsa;\n t=1770416331;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type;\n bh=GrqNvN9Igw7C5M+fSnNqFeNwbMiIeBuEQ+QDuljmH4M=;\n b=zm+X7fOcMEPKusfOiSl4jl5wQoXa1Fi75TSZia19gIOlGc9vD5WcFdNld3rnO2xwCXHG2b\n Uvl4BVQ8/5DODpMtxx211cKTkWm8TYqJdpPBcVyMitAampac+FBxVN6THvtWEl4jf6EAgv\n an1mitBvFSKTwXxc4azXcZF02Q7V9tU=",
            "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz;\n s=susede2_ed25519; t=1770416331;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type;\n bh=GrqNvN9Igw7C5M+fSnNqFeNwbMiIeBuEQ+QDuljmH4M=;\n b=J7I0GIY6G5I165PxEteDH5G2i44spuWKy3IHlnDuj03l8anVMOXMluan2iffTivxiWXkCj\n +vMcusZJaX7FVADQ=="
        ],
        "From": "Martin Jambor <mjambor@suse.cz>",
        "To": "GCC Patches <gcc-patches@gcc.gnu.org>",
        "Cc": "Richard Biener <rguenther@suse.de>",
        "Subject": "[PATCH] tree-sra: Do not propagate bit-field accesses across\n assignments (PR 117217)",
        "User-Agent": "Notmuch/0.38.3 (https://notmuchmail.org) Emacs/30.2\n (x86_64-suse-linux-gnu)",
        "Date": "Fri, 06 Feb 2026 23:18:43 +0100",
        "Message-ID": "<ri6wm0pplbw.fsf@virgil.suse.cz>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Spamd-Result": "default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%];\n NEURAL_HAM_LONG(-1.00)[-1.000];\n NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain];\n RCPT_COUNT_TWO(0.00)[2]; MID_RHS_MATCH_FROMTLD(0.00)[];\n FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[];\n RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[];\n DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519];\n TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[];\n TO_DN_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[];\n RCVD_COUNT_TWO(0.00)[2]; MIME_TRACE(0.00)[0:+]",
        "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": "Hi,\n\non master at least, this is a bug which no longer reproduces with the\nprovided test-cases because after r15-5747-gfd62fdc5e1b3c4:(Jakub\nJelinek: c++: Small initial fixes for zeroing of padding bits\n[PR117256]), the input to SRA looks very different and SRA does not do\nanything.\n\nHowever, before that commit, SRA sees the following input and if it\nencountered something similar now, it could still misbehave in the\nsame way:\n\n  D.2908.i = 0;\n  D.2908.b = 0;\n  e ={v} {CLOBBER(bob)};\n  e.b = MEM[(const struct B &)&D.2908];\n  D.2908 ={v} {CLOBBER(eos)};\n\n(Where the \"e\" in \"e.b\" is actually a MEM_REF of the union type into\n&e so that is why the \"data\" field is missing.)\n\nField D.2908.b is a SRA candidate of boolean type and has size 1 bit\nbecause its decl has size 1 bit even though its type has size 8 bits.\n\nThe SRA access representing the store to D.2908.b is then propagated\nacross the assignment to e and in the process\nbuild_user_friendly_ref_for_offset tries to find a nice expression for\nit to possibly use in warnings.  It finds types_compatible_p\ne.data.a.b which however has size 8 bits and so the verifier screams\nwhen it discovers the discrepancy from the copied-over size of 1 bit.\n\nThis patch avoids the situation by refusing to propagate\nnon-byte-sized accesses across assignments.\n\nThe patch has passed bootstrap and test on x86_64 on master, I am now\nrunning the same on top of the gcc-14 branch.  OK for master and all\nactive release branches if it passes there as well?\n\nThanks,\n\nMartin\n\n\ngcc/ChangeLog:\n\n2026-02-06  Martin Jambor  <mjambor@suse.cz>\n\n\tPR tree-optimization/117217\n\t* tree-sra.cc (propagate_subaccesses_from_rhs): Do not propagate\n\tbit-field children.\n\t(propagate_subaccesses_from_lhs): Likewise.\n\ngcc/testsuite/ChangeLog:\n\n2026-02-06  Martin Jambor  <mjambor@suse.cz>\n\n\tPR tree-optimization/117217\n\t* g++.dg/torture/pr117217-1.C: New test.\n\t* g++.dg/torture/pr117217-2.C: Likewise.\n---\n gcc/testsuite/g++.dg/torture/pr117217-1.C | 24 +++++++++++++++++++++++\n gcc/testsuite/g++.dg/torture/pr117217-2.C | 24 +++++++++++++++++++++++\n gcc/tree-sra.cc                           |  2 ++\n 3 files changed, 50 insertions(+)\n create mode 100644 gcc/testsuite/g++.dg/torture/pr117217-1.C\n create mode 100644 gcc/testsuite/g++.dg/torture/pr117217-2.C",
    "diff": "diff --git a/gcc/testsuite/g++.dg/torture/pr117217-1.C b/gcc/testsuite/g++.dg/torture/pr117217-1.C\nnew file mode 100644\nindex 00000000000..887ab694535\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/torture/pr117217-1.C\n@@ -0,0 +1,24 @@\n+struct [[gnu::packed]] A {\n+  int i;\n+  bool b;\n+};\n+\n+struct [[gnu::packed]] B {\n+  int i;\n+  bool b : 1;\n+};\n+\n+struct E {\n+  union Data {\n+    A a;\n+    B b;\n+    Data(const B &b) : b(b) {}\n+  } data;\n+};\n+\n+extern B copy;\n+\n+int main() {\n+  E e{{B()}};\n+  copy = e.data.b; // NEEDED FOR ICE\n+}\ndiff --git a/gcc/testsuite/g++.dg/torture/pr117217-2.C b/gcc/testsuite/g++.dg/torture/pr117217-2.C\nnew file mode 100644\nindex 00000000000..19390212b48\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/torture/pr117217-2.C\n@@ -0,0 +1,24 @@\n+struct a {\n+  int b;\n+  long c;\n+  long d;\n+  bool f;\n+};\n+struct g {\n+  int b;\n+  long c;\n+  long d;\n+  bool : 1;\n+} h;\n+struct l {\n+  union i {\n+    a j;\n+    g k;\n+    i(g m) : k(m) {}\n+  } data;\n+};\n+int main() {\n+  l e{g()};\n+  h = e.data.k;\n+  return 0;\n+}\ndiff --git a/gcc/tree-sra.cc b/gcc/tree-sra.cc\nindex 151f6005ff3..1f5219d78b2 100644\n--- a/gcc/tree-sra.cc\n+++ b/gcc/tree-sra.cc\n@@ -3258,6 +3258,7 @@ propagate_subaccesses_from_rhs (struct access *lacc, struct access *racc)\n \t}\n \n       if (rchild->grp_unscalarizable_region\n+\t  || (rchild->size % BITS_PER_UNIT) != 0\n \t  || !budget_for_propagation_access (lacc->base))\n \t{\n \t  if (!lacc->grp_write && access_or_its_child_written (rchild))\n@@ -3317,6 +3318,7 @@ propagate_subaccesses_from_lhs (struct access *lacc, struct access *racc)\n       HOST_WIDE_INT norm_offset = lchild->offset + norm_delta;\n \n       if (lchild->grp_unscalarizable_region\n+\t  || (lchild->size % BITS_PER_UNIT) != 0\n \t  || child_would_conflict_in_acc (racc, norm_offset, lchild->size,\n \t\t\t\t\t  &matching_acc)\n \t  || !budget_for_propagation_access (racc->base))\n",
    "prefixes": []
}