Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Apr 2017 21:17:46 +0200
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Brooks Davis <brooks@freebsd.org>
Cc:        Hamza Sheikh <fehrist@codeghar.com>, freebsd-current@freebsd.org
Subject:   Re: buildworld fails with warning in usr.bin/diff/diffreg.c
Message-ID:  <E00B2448-88A8-43EA-9485-6CB957881AFD@FreeBSD.org>
In-Reply-To: <20170424182646.GC11349@spindle.one-eyed-alien.net>
References:  <CABJ3qSNiUY7DrEcz_eN2AqHoNefHGdDe%2Bd%2BsXviNnp9kO7=Qmw@mail.gmail.com> <20170424182646.GC11349@spindle.one-eyed-alien.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_AD86EBA1-E652-4DE8-82AB-E9354F94A89D
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii


> On 24 Apr 2017, at 20:26, Brooks Davis <brooks@freebsd.org> wrote:
>=20
> On Mon, Apr 24, 2017 at 10:04:15AM -0700, Hamza Sheikh wrote:
>> The error is:
>>=20
>> --- all_subdir_usr.bin ---
>> cc1: warnings being treated as errors
>> /home/vagrant/src/usr.bin/diff/diffreg.c: In function 'change':
>> /home/vagrant/src/usr.bin/diff/diffreg.c:1085: warning: 'i' may be
>> used uninitialized in this function
>=20
> If I'm reading the code correctly, this is caused by this code at line
> 1217 and the analyzer being insufficiently smart (all prior uses =
include
> initialization in for() loops):
>=20
>        if (diff_format !=3D D_GFORMAT)
>                i =3D fetch(ixnew, c, d, f2, diff_format =3D=3D =
D_NORMAL ? '>' : '\0', 0, *pflags);
>        if (i !=3D 0 && diff_format =3D=3D D_EDIT) {
>=20
> Adding "i =3D 0;" above this fixes the warning for me and appears to
> preserve the intent.  This variable should be named something other =
than
> i to avoid confusion.

See also https://reviews.freebsd.org/D10462 . Sorry for slacking off on =
that. :)

-Dimitry


--Apple-Mail=_AD86EBA1-E652-4DE8-82AB-E9354F94A89D
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.30

iEYEARECAAYFAlj+T20ACgkQsF6jCi4glqORSgCdHEfGBiNiraZH9wZbHjfsEHIa
XO0AoIV5HhiXsA11TAB41HUz2IYcjToo
=3JPv
-----END PGP SIGNATURE-----

--Apple-Mail=_AD86EBA1-E652-4DE8-82AB-E9354F94A89D--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E00B2448-88A8-43EA-9485-6CB957881AFD>