From owner-freebsd-current@freebsd.org Mon Apr 24 19:18:08 2017 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82EB2D4E05C for ; Mon, 24 Apr 2017 19:18:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:470:7a58:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4EA91A77; Mon, 24 Apr 2017 19:18:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58::5536:3a53:b217:f121] (unknown [IPv6:2001:470:7a58:0:5536:3a53:b217:f121]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id E0B583247C; Mon, 24 Apr 2017 21:18:05 +0200 (CEST) From: Dimitry Andric Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_AD86EBA1-E652-4DE8-82AB-E9354F94A89D"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: buildworld fails with warning in usr.bin/diff/diffreg.c Date: Mon, 24 Apr 2017 21:17:46 +0200 In-Reply-To: <20170424182646.GC11349@spindle.one-eyed-alien.net> Cc: Hamza Sheikh , freebsd-current@freebsd.org To: Brooks Davis References: <20170424182646.GC11349@spindle.one-eyed-alien.net> X-Mailer: Apple Mail (2.3273) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 19:18:08 -0000 --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 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--