)]}'
{
  "commit": "d1722abe60ca7c330210aa97c8ec52ff98644206",
  "tree": "e48e7209588f5e06e31567815beaaa25fe52a195",
  "parents": [
    "aa240fbd480651bd72b3cebe7b5ea1cda204b7e9"
  ],
  "author": {
    "name": "Enze Li",
    "email": "enze.li@hotmail.com",
    "time": "Tue Sep 12 21:40:05 2023 +0800"
  },
  "committer": {
    "name": "Enze Li",
    "email": "enze.li@hotmail.com",
    "time": "Tue Sep 12 21:43:06 2023 +0800"
  },
  "message": "gdb: Fix -Wuninitialized issue\n\nI see the following warning when building GDB on FreeBSD/amd64 with\nClang 14,\n\n\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n  CXX    mdebugread.o\nmdebugread.c:1069:3: error: variable \u0027f\u0027 is uninitialized when used here [-Werror,-Wuninitialized]\n                f-\u003eset_loc_enumval (tsym.value);\n                ^\nmdebugread.c:836:17: note: initialize the variable \u0027f\u0027 to silence this warning\n        struct field *f;\n                       ^\n                        \u003d nullptr\n\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n\nafter digging a little, I realized that we can not simply do what\nClang 14 says.\n\nThe root cause of this issue is that we lost the initialization of\nthe variable \u0027f\u0027 in this commit,\n\n  commit 2774f2dad5f05e68771c07df6ab0fb23baa2118e\n  Date:   Thu Aug 31 09:37:44 2023 +0200\n\n      [gdb/symtab] Factor out type::{alloc_fields,copy_fields}\n\nwe have made these modifications,\n\n ---------------------------------------------------------------------\n --- a/gdb/mdebugread.c\n +++ b/gdb/mdebugread.c\n @@ -1034,9 +1034,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,\n\n         t-\u003eset_code (type_code);\n         t-\u003eset_length (sh-\u003evalue);\n -       t-\u003eset_num_fields (nfields);\n -       f \u003d ((struct field *) TYPE_ALLOC (t, nfields * sizeof (struct field)));\n -       t-\u003eset_fields (f);\n +       t-\u003ealloc_fields (nfields, false);\n ---------------------------------------------------------------------\n\nThe problem is that the variable \u0027f\u0027 is used in the second half of\nparse_symbol, that\u0027s why Clang complained.\n\nTo fix this issue we need to ensure that the varibale \u0027f\u0027 is\ninitialized.  Calling the fields method is an obvious way to fix this\nissue.\n\nTested on FreeBSD/amd64 by rebuilding.\n\nApproved-By: Tom de Vries \u003ctdevries@suse.de\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "ea3e15be53b286160a0da892e016b06bb3e2b251",
      "old_mode": 33188,
      "old_path": "gdb/mdebugread.c",
      "new_id": "9cb30ce0acd0f21911bd6d83f73543f740db8a91",
      "new_mode": 33188,
      "new_path": "gdb/mdebugread.c"
    }
  ]
}
