)]}'
{
  "commit": "ea9ea72e448e391d4be781b74956a0190f93afc8",
  "tree": "b751bf1b838f492403b55dfb05bb75889e76ce03",
  "parents": [
    "2c3559839d70df6311da18fd93237050405580c3"
  ],
  "author": {
    "name": "Jakub Jelinek",
    "email": "jakub@redhat.com",
    "time": "Thu Jun 05 15:47:19 2025 +0200"
  },
  "committer": {
    "name": "Jakub Jelinek",
    "email": "jakub@gcc.gnu.org",
    "time": "Thu Jun 05 15:47:19 2025 +0200"
  },
  "message": "real: Fix up real_from_integer [PR120547]\n\nThe function has 2 problems, one is _BitInt specific and the other is\nmost likely also reproduceable only with it.\n\nThe first issue is that I\u0027ve missed updating the function for _BitInt,\nmaxbitlen as MAX_BITSIZE_MODE_ANY_INT + HOST_BITS_PER_WIDE_INT\nobviously isn\u0027t guaranteed to be larger than any integral type we might\nwant to convert at compile time from wide_int to REAL_VALUE_FORMAT.\nJust using len instead of it works fine, at least when used after\nHOST_BITS_PER_WIDE_INT is added to it and it is truncated to multiples\nof HOST_BITS_PER_WIDE_INT.\n\nThe other bug is that if the value has too many significant bits (formerly\nmaxbitlen - cnt_l_z, now len - cnt_l_z), the code just shifts it right and\nadds the shift count to the future exponent.  That isn\u0027t correct for\nrounding as the testcase attempts to show, the internal real format has more\nbits than any precision in supported format, but we still need to\ndistinguish bewtween values exactly half way between representable floating\npoint values (those should be rounded to even) and the case when we\u0027ve\nshifted away some non-zero bits, so the value was tiny bit larger than half\nway and then we should round up.\n\nThe patch uses something like e.g. soft-fp uses in these cases, right shift\nwith sticky bit in the least significant bit.\n\n2025-06-05  Jakub Jelinek  \u003cjakub@redhat.com\u003e\n\n\tPR middle-end/120547\n\t* real.cc (real_from_integer): Remove maxbitlen variable, use\n\tlen instead of that.  When shifting right, or in 1 if any of the\n\tshifted away bits are non-zero.  Formatting fix.\n\n\t* gcc.dg/bitint-123.c: New test.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "b64bad0e9b27512717b956f442b28ce49b872ef2",
      "old_mode": 33188,
      "old_path": "gcc/real.cc",
      "new_id": "95a933220b5d1092913e60f0be8e9dc85ee2bd17",
      "new_mode": 33188,
      "new_path": "gcc/real.cc"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "4d019a98fdfc76fea3cbefe48e8fe975853c9a14",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/gcc.dg/bitint-123.c"
    }
  ]
}
