)]}'
{
  "commit": "d7fa48a8500bcfaa1cf4ae3f917c22aa6ec7c75f",
  "tree": "58cf6e2473959aac6611fcdbf0415e240b97b5ce",
  "parents": [
    "d9128914a30615902befa37be7aacab28696d06a"
  ],
  "author": {
    "name": "Jakub Jelinek",
    "email": "jakub@redhat.com",
    "time": "Wed Sep 16 22:22:20 2026 +0200"
  },
  "committer": {
    "name": "Jakub Jelinek",
    "email": "jakub@gcc.gnu.org",
    "time": "Wed Sep 16 22:22:20 2026 +0200"
  },
  "message": "c: Fix up integer promotion of bit-precise bit-fields [PR127383]\n\nThe following testcases are miscompiled when a bit-precise integer\nbit-field is explicitly cast to a non-cv-qualified bit-precise integer\n(of the same signedness) with precision of the bit-field width.\nWe can then incorrectly apply an integer promotion of the bit-field\nto the corresponding bit-precise integer, even when it shouldn\u0027t be\napplied (because it is a cast rather than the bit-field itself).\nRegardless of the cv-qualifications, the TREE_TYPE of the FIELD_DECLs\n(and COMPONENT_REFs) is a cv-unqualified BITINT_TYPE.  We first call\nconvert to that type in convert_lvalue_to_rvalue and that doesn\u0027t change\nanything.\nIf there is an explicit cast to the same type as the TREE_TYPE of\nthe COMPONENT_REF has, we usually wrap it into a NON_LVALUE_EXPR, because\nthe COMPONENT_REF is usually an lvalue (but as can be seen in the testcases,\nnot always).  So the second hunk makes sure to add NON_LVALUE_EXPR around\nthe COMPONENT_REF even in the (cast) foo ().a cases to distinguish it\nfrom foo ().a.\nThe second change is in default_conversion, for the promotion of bit-fields\nof bit-precise integer type we don\u0027t promote them if they are wrapped in\nsome cast or NON_LVALUE_EXPR (the function normally uses STRIP_TYPE_NOPS).\n\n2026-09-16  Jakub Jelinek  \u003cjakub@redhat.com\u003e\n\n\tPR c/127383\n\t* c-typeck.cc (default_conversion): If orig_expr is different\n\tfrom exp and exp is a bit-field of bit-precise integer type, call\n\tperform_integral_promotions on orig_exp rather than exp.\n\t(build_c_cast): Wrap in NON_LVALUE_EXPR not just lvalues, but\n\talso non-lvalue bit-fields of bit-precise integer type.\n\n\t* gcc.dg/torture/bitint-108.c: New test.\n\t* gcc.dg/bitint-143.c: New test.\n\t* gcc.dg/bitint-144.c: New test.\n\nReviewed-by: Joseph Myers \u003cjosmyers@redhat.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "ed234f075ca8433c45648aef6cd68890afb03f56",
      "old_mode": 33188,
      "old_path": "gcc/c/c-typeck.cc",
      "new_id": "ed755ff0e50b994c01cfab7257eddd55994316c4",
      "new_mode": 33188,
      "new_path": "gcc/c/c-typeck.cc"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "eedddce2b22179169e9ee212908829056a48e824",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/gcc.dg/bitint-143.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "83114ba84eb029eaffcbc8c16658e9c979fe8101",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/gcc.dg/bitint-144.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "19c9b3e046fc9c2872b3fde2ef0d2e940ab1a65c",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/gcc.dg/torture/bitint-108.c"
    }
  ]
}
