)]}'
{
  "commit": "a5e5c22ad4862846ea705d43c640ca18cc9dd78a",
  "tree": "0b7dfe6cd4257d6302a51988157785a45dc299c7",
  "parents": [
    "6f32166346de2d1c0f6253e4fe37e8a6edac655d"
  ],
  "author": {
    "name": "Jakub Jelinek",
    "email": "jakub@redhat.com",
    "time": "Fri Jul 31 08:58:27 2026 +0200"
  },
  "committer": {
    "name": "Jakub Jelinek",
    "email": "jakub@gcc.gnu.org",
    "time": "Fri Jul 31 08:58:27 2026 +0200"
  },
  "message": "c++: Don\u0027t cache calls which rethrow etc. [PR126508]\n\nThe first 3 testcase below are miscompiled, we happily cache\ncalls during constant evaluation which don\u0027t depend just on their\narguments, but also on the current exceptions (uncaught or caught).\nIf we decide to cache such functions and then try to evaluate them\nwith different uncaught/caught exceptions (or none), we can get wrong\nresults.\nWe already don\u0027t cache calls which allocate and don\u0027t free all heap\nallocations, or free some heap allocations they haven\u0027t allocated,\nor which call (right now any) metafunctions, or have exited through\nexception, or aren\u0027t constant.\nThis patch just adds the rethrow/__builtin_uncaught_exceptions/\n__builtin_current_exception calls to the set of non-cacheable operations\n(to be precise, e.g. rethrow would be safe to cache if we can prove\nthat the current exception was always thrown from within that function,\nditto __builtin_current_exception, but it is hard to figure out).\nThe last testcase attempts to check if we don\u0027t need something similar\nalso for __builtin_eh_ptr_adjust_ref, but the call to foo for some reason\nisn\u0027t cached and so I don\u0027t have a proof we need to handle it too.\n\n2026-07-31  Jakub Jelinek  \u003cjakub@redhat.com\u003e\n\n\tPR c++/126508\n\t* constexpr.cc (cxx_eval_cxa_builtin_fn): Avoid caching\n\tcalls which rethrow or call __builtin_uncaught_exceptions\n\tor __builtin_current_exception.\n\n\t* g++.dg/cpp26/constexpr-eh20.C: New test.\n\t* g++.dg/cpp26/constexpr-eh21.C: New test.\n\t* g++.dg/cpp26/constexpr-eh22.C: New test.\n\t* g++.dg/cpp26/constexpr-eh23.C: New test.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "b4db9fd2bae42663ae1f13de742b2e1b459b29c1",
      "old_mode": 33188,
      "old_path": "gcc/cp/constexpr.cc",
      "new_id": "105f3c6d8149336c43e3cc00e14d218d2a364f65",
      "new_mode": 33188,
      "new_path": "gcc/cp/constexpr.cc"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "438469825d49928be23be693887fd875312ff93b",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/g++.dg/cpp26/constexpr-eh20.C"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "30fd6dc84b9d8bfc7e08fbb09ef91db63a407c32",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/g++.dg/cpp26/constexpr-eh21.C"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "291ec3386cc8f5f6a1009dc9a497157591dbcac1",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/g++.dg/cpp26/constexpr-eh22.C"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "1b1a77d69d6e4520e6563ef114e7e2de382ef4fe",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/g++.dg/cpp26/constexpr-eh23.C"
    }
  ]
}
