From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=58506 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P5Kuo-00085x-B3 for qemu-devel@nongnu.org; Mon, 11 Oct 2010 12:08:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P5Kug-0002TV-3d for qemu-devel@nongnu.org; Mon, 11 Oct 2010 12:07:54 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:52116) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P5Kuf-0002SS-PN for qemu-devel@nongnu.org; Mon, 11 Oct 2010 12:07:46 -0400 Message-ID: <4CB3364D.4010707@mail.berlios.de> Date: Mon, 11 Oct 2010 18:07:41 +0200 From: Stefan Weil MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 03/12] eepro100: initialize a variable in all cases References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Blue Swirl , qemu-devel Am 11.10.2010 16:53, schrieb Markus Armbruster: > Blue Swirl writes: > >> Compiling with GCC 4.6.0 20100925 produced warnings: >> /src/qemu/hw/eepro100.c: In function 'eepro100_read4': >> /src/qemu/hw/eepro100.c:1351:14: error: 'val' may be used >> uninitialized in this function [-Werror=uninitialized] >> /src/qemu/hw/eepro100.c: In function 'eepro100_read2': >> /src/qemu/hw/eepro100.c:1328:14: error: 'val' may be used >> uninitialized in this function [-Werror=uninitialized] >> /src/qemu/hw/eepro100.c: In function 'eepro100_read1': >> /src/qemu/hw/eepro100.c:1285:13: error: 'val' may be used >> uninitialized in this function [-Werror=uninitialized] >> >> Fix by initializing 'val' at start. > > I don't like sweeping bugs under the carpet like that. The initial > value is used when and only when the emulation is buggy. We doubt it > can happen. If we truly believe it can't happen, assert it. If we just > doubt it, log it. Markus, that patch would only be an intermediate solution which helps to fix a certain class of compiler warnings. I already promised to test the code with assertions and started doing so (see my qemu repository http://repo.or.cz/w/qemu/ar7.git/history/HEAD:/hw/eepro100.c). Testing takes some time, so the intermediate solution can be reasonable. But nothing will be swept under the carpet!