)]}'
{
  "commit": "b14ad46e6689cba2dd316bf677ad4f36278f9d3d",
  "tree": "5579ae1bdfca7e8fc26a92393c8cddb0ce1d038d",
  "parents": [
    "4790838765e8a4b0580b11ba0d8c6671d7c3fc95"
  ],
  "author": {
    "name": "Kyrylo Tkachov",
    "email": "ktkachov@nvidia.com",
    "time": "Wed Jun 17 02:03:41 2026 -0700"
  },
  "committer": {
    "name": "Kyrylo Tkachov",
    "email": "ktkachov@nvidia.com",
    "time": "Tue Jul 07 14:03:47 2026 +0200"
  },
  "message": "aarch64: Fix ICE in aarch64_function_arg_alignment with may_alias [PR124146]\n\naarch64_function_arg_alignment returns the ABI alignment of an argument.\nFor scalars and vectors this is the natural alignment of the type,\nignoring any user-specified alignment.  The code obtains the natural\nalignment from the TYPE_MAIN_VARIANT, relying on the main variant having\nno user alignment.  PR108910 showed that this does not hold for pointers,\nand that case is handled explicitly.\n\nPR124146 is another counterexample.  An attribute that affects type\nidentity, such as may_alias, makes a type its own TYPE_MAIN_VARIANT, so\nthe main variant retains the user alignment requested by the aligned\nattribute.  TYPE_MAIN_VARIANT therefore does not strip the alignment and\nthe gcc_assert (!TYPE_USER_ALIGN (type)) fires.\n\nIn the testcase the may_alias+aligned type reaches the argument-passing\ncode because foo is inlined into bar and forwprop propagates the value\nof that type directly into the recursive call to bar.\n\nFix it by ignoring user alignment explicitly: when the type still has\nuser alignment, use the natural alignment of its mode, exactly as the\n!type path at the top of the function already does.  Behaviour is\nunchanged for the existing (non-user-aligned) cases, since the natural\nalignment of a scalar or vector equals its mode alignment.  This also\ngives the natural alignment when a may_alias typedef lowers the\nalignment of a 16-byte type, matching the AAPCS64 (and Clang).\n\nThe same applies to _BitInt, which is covered by pr124146-4.c: user\nalignment is ignored so a _BitInt up to 64 bits uses a single register,\none between 65 and 128 bits uses a 16-byte two-register container, and\none wider than 128 bits is passed by reference.\n\nBootstrapped and tested on aarch64-none-linux-gnu.\n\ngcc/\n\tPR target/124146\n\t* config/aarch64/aarch64.cc (aarch64_function_arg_alignment):\n\tIgnore user alignment left on a type\u0027s main variant; use the\n\tmode\u0027s natural alignment instead.\n\ngcc/testsuite/\n\tPR target/124146\n\t* gcc.target/aarch64/pr124146.c: New test.\n\t* gcc.target/aarch64/pr124146-2.c: New test.\n\t* gcc.target/aarch64/pr124146-3.c: New test.\n\t* gcc.target/aarch64/pr124146-4.c: New test.\n\nSigned-off-by: Kyrylo Tkachov \u003cktkachov@nvidia.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "78f1eae8336c9bd4f8fc529154065b11e8394b13",
      "old_mode": 33188,
      "old_path": "gcc/config/aarch64/aarch64.cc",
      "new_id": "5c018d929861375b490989213e5d9c6f7b5e85eb",
      "new_mode": 33188,
      "new_path": "gcc/config/aarch64/aarch64.cc"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "3dabdc59e02cab6f7fea9bedd1202f9ad3205913",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/gcc.target/aarch64/pr124146-2.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "f9ca9319d7729e37e2ebe3efbf8ca0e595c5af48",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/gcc.target/aarch64/pr124146-3.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "b8e79b13d70052e94ec4131615d47329c58202db",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/gcc.target/aarch64/pr124146-4.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "29142847ed465a3703fe17f4e933fb76f88c036e",
      "new_mode": 33188,
      "new_path": "gcc/testsuite/gcc.target/aarch64/pr124146.c"
    }
  ]
}
