Date: Sun, 13 Dec 2015 10:13:06 +0100 From: Dimitry Andric <dim@FreeBSD.org> To: Kai Wang <kaiw27@gmail.com> Cc: Adrian Chadd <adrian.chadd@gmail.com>, Ed Maste <emaste@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org> Subject: Re: svn commit: r292120 - in head/contrib/elftoolchain: addr2line common elfcopy libelf readelf Message-ID: <54DEE8D2-6ED9-42D4-B480-299C23CB2D66@FreeBSD.org> In-Reply-To: <CAMf2Fe7AK5K99nrUE4Rx7Zp6PKD%2Bg-LAqZzJLRJO1GdgEqS7yQ@mail.gmail.com> References: <201512112028.tBBKSRtn092966@repo.freebsd.org> <CAJ-VmomX%2BSYUwMpWkTiXMqAhQE%2BthmaMse7KnTFXWqc4JpXmPA@mail.gmail.com> <CAMf2Fe7AK5K99nrUE4Rx7Zp6PKD%2Bg-LAqZzJLRJO1GdgEqS7yQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On 13 Dec 2015, at 09:43, Kai Wang <kaiw27@gmail.com> wrote:
>
> 2015-12-13 7:04 GMT+01:00 Adrian Chadd <adrian.chadd@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
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.28
iEYEARECAAYFAlZtNqgACgkQsF6jCi4glqNtNgCgqXUa+7zhqWdqsKKuhLLC2dGq
9vcAoKidiRBPCCFY0wX0DQ9ZJwH8nLKL
=Q7rP
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54DEE8D2-6ED9-42D4-B480-299C23CB2D66>
