)]}'
{
  "commit": "b9a8ba09bfac74e60359b04563dc1bd75cd2d5ee",
  "tree": "3cd0c3e6bb9038cd869191c2bf929b458200c4a6",
  "parents": [
    "bd18f6c4a6adcd63253f200f7f63377583629916"
  ],
  "author": {
    "name": "Martin Jambor",
    "email": "mjambor@suse.cz",
    "time": "Tue May 12 14:59:13 2026 +0200"
  },
  "committer": {
    "name": "Martin Jambor",
    "email": "jamborm@gcc.gnu.org",
    "time": "Thu May 28 15:25:21 2026 +0200"
  },
  "message": "sra: Fix build_user_friendly_ref_for_offset for bit-fields (PR124151)\n\nWhen SRA propagates bit-field propagations across assignments, it\nfirst attempts to use build_user_friendly_ref_for_offset to represent\nthe expression of the new accesses and a possible scalar replacement\nso that if there are any warnings generated for it, they are as nice\nas we can make them.\n\nHowever, this can lead to situations where, despite that the new\naccess has exactly the same type as the new old one, it accesses a\n(record or union): field which is just big enough for its precision,\nwhereas the one we want to match has size rounded up to bytes.  This\ncauses discrepancy between the recorded size of the new access and the\nsize get_ref_base_and_extent reports for its expr, which trips the\nverifier.\n\nUnlike the previous approach which avoided propagation in the case of\nbit fields, this patch fixes build_user_friendly_ref_for_offset by\nmaking it also track the size it is looking at and the size it is\nlooking for so that it can declare success only if these two also\nmatch.  Additionally, it reverts the simple bail-out fix for PR 117217\nbecause it is no longer necessary.  (I have verified the bug is still\nfixed though by applying the new fix on top of the last problematic\ncommit.)\n\ngcc/ChangeLog:\n\n2026-04-29  Martin Jambor  \u003cmjambor@suse.cz\u003e\n\n\tPR tree-optimization/124151\n\t* tree-sra.cc (build_user_friendly_ref_for_offset): Added parameters\n\tCUR_SIZE and EXP_SIZE.  Added code passing the correct CUR_SIZE and\n\tchecking it against EXP_SIZE.  Removed unused code for the case when\n\tEXP_TYPE was NULL_TREE.\n\t(create_artificial_child_access): Adjusted the call to\n\tbuild_user_friendly_ref_for_offset.\n\t(propagate_subaccesses_from_rhs): Likewise.\n\t(propagate_subaccesses_from_rhs): Removed a check that the size of\n\tlchild is a multiple of BITS_PER_UNIT.\n\t(propagate_subaccesses_from_lhs): Likewise.\n\ngcc/testsuite/ChangeLog:\n\n2026-04-29  Martin Jambor  \u003cmjambor@suse.cz\u003e\n\n\tPR tree-optimization/124151\n\t* gcc.dg/tree-ssa/pr124151.c: New test.\n\n(cherry picked from commit a202c707bea3ff021b44aa00c0570798a30aae31)\n",
  "tree_diff": [
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "37d3edc3812ea315292b7fd03894f00cff21ffbd",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/gcc.dg/tree-ssa/pr124151.c"
    },
    {
      "type": "modify",
      "old_id": "293386b6c2989ee43695435d406b1435d7c9e46c",
      "old_mode": 33188,
      "old_path": "gcc/tree-sra.cc",
      "new_id": "fde4d558f0eb0d6fb47e15766c5a2ed9493f57a0",
      "new_mode": 33188,
      "new_path": "gcc/tree-sra.cc"
    }
  ]
}
