)]}'
{
  "commit": "237df762d73a7fdf910277b0644df58688d2d87a",
  "tree": "8cea227ad3ee3b2777893acc19f6f0d2bd54011f",
  "parents": [
    "4eb59a5243cbca011c58274a20235a163243f97f"
  ],
  "author": {
    "name": "Shahab Vahedi",
    "email": "shahab.vahedi@amd.com",
    "time": "Wed Sep 04 12:15:14 2024 +0200"
  },
  "committer": {
    "name": "Jan Beulich",
    "email": "jbeulich@suse.com",
    "time": "Fri Sep 06 08:36:32 2024 +0200"
  },
  "message": "bfd: Fix GCC warning when CFLAGS\u003d\"-Og\" is used\n\nThis patch initializes the \"op\" variable in skip_cfa_op() function\nof bfd/elf-eh-frame.c to \"0\" at its declaration point to avoid the\n\"maybe-uninitialized\" warning.\n\nBuilding binutils on a system with GCC version 13.2.0 and a configure\ncommand that sets the optimization level to \"-Og\" leads to a build\nfailure because of a warning being treated as an error:\n---------------------------------------------------------------------\n$ ./configure CFLAGS\u003d\"-Og\"\n$ make\n  ...\n  CC       elf-eh-frame.lo\n  /src/gdb/bfd/elf-eh-frame.c: In function \u0027skip_cfa_op\u0027:\n  /src/gdb/bfd/elf-eh-frame.c:354:33: error: \u0027op\u0027 may be used\n    uninitialized [-Werror\u003dmaybe-uninitialized]\n  354 |   switch (op \u0026 0xc0 ? op \u0026 0xc0 : op)\n      |           ~~~~~~~~~~~~~~~~~~~~~~^~~~\n  /src/gdb/bfd/elf-eh-frame.c:348:12: note: \u0027op\u0027 was declared here\n  348 |   bfd_byte op;\n      |            ^~\n  cc1: all warnings being treated as errors\n  ...\n---------------------------------------------------------------------\n\nThe relevant code snippet related to this warning looks like:\n---------------------------------------------------------------------\n  static inline bool\n  read_byte (bfd_byte **iter, bfd_byte *end, unsigned char *result)\n  {\n    if (*iter \u003e\u003d end)\n      return false;\n    *result \u003d *((*iter)++);\n    return true;\n  }\n\n  static bool\n  skip_cfa_op (bfd_byte **iter, bfd_byte *end,...)\n  {\n    bfd_byte op;\n\n    if (!read_byte (iter, end, \u0026op))\n      return false;\n\n    switch (op \u0026 0xc0 ? op \u0026 0xc0 : op)\n    ...\n  }\n---------------------------------------------------------------------\n\nThis warning probably happens because \"-Og\" results in GCC not\ninlining the \"read_byte()\" function. Therefore, GCC treats its\ninvocation inside \"skip_cfa_op()\" like a black box and that ends\nin the aforementioned warning.\n\nAcknowledgement:\n  Lancelot Six -- for coming with the idea behind this fix.\n  Jan Beulich  -- for reviewing.\n\nbfd/ChangeLog:\n\t* elf-eh-frame.c (skip_cfa_op): Initialize the \"op\" variable.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "902d7c16334ea725b0caac8033d05422316bb4c5",
      "old_mode": 33188,
      "old_path": "bfd/elf-eh-frame.c",
      "new_id": "ebe162f2e5fccd1f22691f7c9053f8918e619b45",
      "new_mode": 33188,
      "new_path": "bfd/elf-eh-frame.c"
    }
  ]
}
