)]}'
{
  "commit": "1bcce941ebbb9ad97997a86432da88c8a9117d4b",
  "tree": "7ec8aaf9ff3acce9119d7fa3eb125fb68e04b037",
  "parents": [
    "7ae96151ed91609c331d7199e71cf14072c120fd"
  ],
  "author": {
    "name": "Kyrylo Tkachov",
    "email": "ktkachov@nvidia.com",
    "time": "Tue Sep 08 11:05:32 2026 +0200"
  },
  "committer": {
    "name": "Kyrylo Tkachov",
    "email": "ktkachov@nvidia.com",
    "time": "Tue Sep 15 08:39:52 2026 +0200"
  },
  "message": "middle-end: Use conservative store semantics for MEM_NOTRAP [PR127185]\n\nset_mem_attributes derives MEM_NOTRAP from tree_could_trap_p.  That\npredicate describes a load.  A store to readonly or otherwise unwritable\nmemory can therefore be marked as nontrapping.  RTL exception analysis can\nthen omit an edge for a store that can raise a non-call exception.\n\nFor example, the asm output in the test was marked nontrapping:\n\n  (set (mem/u/c:SI (...) [ output+0 ]) ...)\n\nUse store trap semantics for it instead:\n\n  (set (mem/u:SI (...) [ output+0 ]) ...)\n\nAdd MAY_STORE_P to the memory attribute setters and use lhs_could_trap_p\nwhen it is true.  Default MAY_STORE_P to true so that an unclassified\ncaller cannot create an unsafe nontrapping claim.\n\nEXPAND_NORMAL is the only expand modifier that guarantees that a memory\nreference describes a load.  Treat the other modifiers conservatively.\nThis includes EXPAND_STACK_PARM and the direction-neutral EXPAND_MEMORY.\nRecompute MEM_NOTRAP on copied declaration RTL so that a normal load keeps\nthe nontrapping form:\n\n  (mem/u/c:SI (...) [ output+0 ])\n\nThis can lose MEM_NOTRAP precision for loads expanded with a\ndirection-neutral modifier.  Later patches restore that precision for\nget_memory_rtx, memory-only inline-assembly inputs, partial loads, and STRUB\nwatermark loads.\n\nBootstrapped and tested on aarch64-unknown-linux-gnu.  Tested on\nx86_64-pc-linux-gnu.\n\n\tPR middle-end/127185\n\ngcc/ChangeLog:\n\n\t* emit-rtl.cc (set_mem_attributes_minus_bitpos): Add MAY_STORE_P.\n\tUse lhs_could_trap_p when it is true.\n\t(set_mem_attributes): Add MAY_STORE_P and pass it through.\n\t* emit-rtl.h (set_mem_attributes): Add MAY_STORE_P with a\n\tconservative default.\n\t(set_mem_attributes_minus_bitpos): Likewise.\n\t* expr.cc (expand_assignment): Mark the destination as a store.\n\t(expand_expr_real_1): Treat only EXPAND_NORMAL as a known load.\n\tSet MEM_NOTRAP from the access direction.\n\ngcc/testsuite/ChangeLog:\n\n\t* g++.dg/eh/noncall-store-2.C: New test.\n\t* g++.dg/opt/mem-notrap-store-asm.C: New test.\n\nSigned-off-by: Kyrylo Tkachov \u003cktkachov@nvidia.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "a190429cf22cf867f99af36454b7fd6f74bceb9c",
      "old_mode": 33188,
      "old_path": "gcc/emit-rtl.cc",
      "new_id": "d064b2a1064b97b831dd1189ff617079158628fb",
      "new_mode": 33188,
      "new_path": "gcc/emit-rtl.cc"
    },
    {
      "type": "modify",
      "old_id": "0b572580a98e3948ddf7e1d8ba1ca744aefe258c",
      "old_mode": 33188,
      "old_path": "gcc/emit-rtl.h",
      "new_id": "5fae3264cb5e4a1fbd34f1b8b772d027276698b8",
      "new_mode": 33188,
      "new_path": "gcc/emit-rtl.h"
    },
    {
      "type": "modify",
      "old_id": "a64fa974048d0cd6e7ad9cbc3becf3c1d855dc97",
      "old_mode": 33188,
      "old_path": "gcc/expr.cc",
      "new_id": "a9157dc5d415b5afa06a1c80ccb01e81abf7efe8",
      "new_mode": 33188,
      "new_path": "gcc/expr.cc"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "c095c71ca930b8c1c65b2b1143d110367d35245c",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/g++.dg/eh/noncall-store-2.C"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "ef26e2283317806b44df1d62e6adaccf173e6b11",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/g++.dg/opt/mem-notrap-store-asm.C"
    }
  ]
}
