)]}'
{
  "commit": "b2ea48df925a6d41f63e88b26dbf3f17cde0f252",
  "tree": "90faff9a96d7518eb11b590eaa2327c3b28c67c8",
  "parents": [
    "707877ab59c6d0cbcb58cb5d467ab5f0d071a935"
  ],
  "author": {
    "name": "Mike Frysinger",
    "email": "vapier@gentoo.org",
    "time": "Sat Jan 06 23:16:41 2024 -0500"
  },
  "committer": {
    "name": "Mike Frysinger",
    "email": "vapier@gentoo.org",
    "time": "Mon Jan 08 20:01:05 2024 -0500"
  },
  "message": "sim: cgen: rework DI macros to avoid signed left shifts\n\nThe cgen code uses DI as int64_t and UDI as uint64_t.  The DI macros\nare used to construct 64-bit values from 32-bit values (for the low\nand high parts).  The MAKEDI macro casts the high 32-bit value to a\nsigned 32-bit value before shifting.  If this created a negative\nvalue, this would be undefined behavior according to the C standard.\nAll we care about is shifting the 32-bits as they are to the high\n32-bits, not caring about sign extension (since there\u0027s nothing left\nto shift into), and the low 32-bits being empty.  This is what we\nget from shifting an unsigned value, so cast it to unsigned 32-bit\nto avoid undefined behavior.\n\nWhile we\u0027re here, change the SETLODI macro to truncate the lower\nvalue to 32-bits before we set it.  If it was passing in a 64-bit\nvalue, those high bits would get included too, and that\u0027s not what\nwe want.\n\nSimilarly, tweak the SETHIDI macro to cast the value to an unsigned\n64-bit instead of a signed 64-bit.  If the value was only 32-bits,\nthe behavior would be the same.  If it happened to be signed 64-bit,\nit would trigger the undefined behavior too.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "01a3ee9be584577ba0f3fd0214370670d325f4d2",
      "old_mode": 33188,
      "old_path": "sim/common/cgen-types.h",
      "new_id": "24c2b89216fcaffb6fe6a2bd9ac665560219aa50",
      "new_mode": 33188,
      "new_path": "sim/common/cgen-types.h"
    }
  ]
}
