On 13 Dec 2015, at 09:43, Kai Wang <kai...@gmail.com> wrote: > > 2015-12-13 7:04 GMT+01:00 Adrian Chadd <adrian.ch...@gmail.com>: > cc1: warnings being treated as errors > /usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c: > In function 'dump_dwarf': > /usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:7479: > warning: 'b' may be used uninitialized in this function > /usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:7479: > note: 'b' was declared here > /usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:4758: > warning: 'pe' may be used uninitialized in this function > /usr/home/adrian/work/freebsd/head-embedded/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:4758: > note: 'pe' was declared here > > .. these both seem like legit. > > > Hi, > > Sorry about the breakage. Should be fixed by r292158. > Somehow clang didn't catch this. Had to use gcc to see this warning.
Indeed, this is interesting. For clang to warn similarly, the -Wconditional-uninitialized option has to be enabled explicitly, and then you get a lot of them (this is from just before your commit): /usr/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:4861:33: error: variable 'pe' may be uninitialized when used here [-Werror,-Wconditional-uninitialized] dirndx = _decode_uleb128(&p, pe); ^~ /usr/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:4758:17: note: initialize the variable 'pe' to silence this warning uint8_t *p, *pe; ^ = NULL /usr/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:6167:8: error: variable 'cie_ra' may be uninitialized when used here [-Werror,-Wconditional-uninitialized] cie_ra); ^~~~~~ /usr/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:6060:19: note: initialize the variable 'cie_ra' to silence this warning Dwarf_Half cie_ra; ^ = 0 /usr/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:6164:8: error: variable 'cie_caf' may be uninitialized when used here [-Werror,-Wconditional-uninitialized] cie_caf, cie_daf, low_pc, re->dbg); ^~~~~~~ /usr/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:6057:24: note: initialize the variable 'cie_caf' to silence this warning Dwarf_Unsigned cie_caf, cie_daf, cie_instlen, func_len, fde_length; ^ = 0 /usr/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:6164:17: error: variable 'cie_daf' may be uninitialized when used here [-Werror,-Wconditional-uninitialized] cie_caf, cie_daf, low_pc, re->dbg); ^~~~~~~ /usr/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:6057:33: note: initialize the variable 'cie_daf' to silence this warning Dwarf_Unsigned cie_caf, cie_daf, cie_instlen, func_len, fde_length; ^ = 0 /usr/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:7492:21: error: variable 'b' may be uninitialized when used here [-Werror,-Wconditional-uninitialized] if (shift < 32 && (b & 0x40) != 0) ^ /usr/src/usr.bin/readelf/../../contrib/elftoolchain/readelf/readelf.c:7479:11: note: initialize the variable 'b' to silence this warning uint8_t b; ^ = '\0' 5 errors generated. I'll check if there is a specific reason upstream does not enable this warning by default for -Wall. Maybe there is a risk of false positives. -Dimitry
signature.asc
Description: Message signed with OpenPGP using GPGMail